-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkingCode_Duplicates_28_June_10_48PM.txt
More file actions
105 lines (88 loc) · 3.36 KB
/
workingCode_Duplicates_28_June_10_48PM.txt
File metadata and controls
105 lines (88 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import arcpy
import xlrd
import array
from array import *
counterSHP = 0
counterXLS = 0
check = 0
list = []
list2 = []
A = arcpy.GetParameterAsText(0) # Import
arcpy.AddMessage("Params")
arcpy.AddMessage(A)
outputFolderPath = arcpy.GetParameterAsText(2)
arcpy.AddMessage("outputFolderPath ")
arcpy.AddMessage(outputFolderPath)
anyValue = arcpy.GetParameterAsText(3)
arcpy.AddMessage("Any Value ")
arcpy.AddMessage(anyValue)
myList = [arcpy.GetParameterAsText(0)]
arcpy.AddMessage("params length")
arcpy.env.workspace = "F:\Survey\Mussoorie\Test For Automation back to arcgis"
arcpy.AddMessage(arcpy.ListFiles("*.xls")[0]) # returns the name of the .xlsm file at the zeroeth location
#arcpy.AddMessage(arcpy.ListFiles("*.shp")[0]) # returns the name of the .shp file at the zeroeth location
#arcpy.AddMessage(len(arcpy.ListFiles("*.shp")[0])) # returns the length of the name of the file at the zeroeth location
#arcpy.AddMessage(arcpy.ListFiles("*.shp")[0][:2]) # returns the first 2 characters of the name of the file
for i in arcpy.ListFiles("*.xls"): # 19
#a= array(i)
counterXLS = counterXLS + 1
arcpy.AddMessage("IN FOR")
arcpy.AddMessage(i)
book = xlrd.open_workbook(i)
sheet = book.sheet_by_index(0) # Get the first sheet
arcpy.AddMessage(counterSHP)
list.append([sheet.cell(14,7)])
arcpy.AddMessage (sheet.cell(14,7).value) # 27
arcpy.AddMessage(arcpy.ListFiles("*.shp")[counterXLS-1])
arcpy.AddMessage ("final OutPut Path454")
arcpy.AddMessage (outputFolderPath+str(sheet.cell(15,7).value)+arcpy.ListFiles("*.shp")[counterXLS-1])
#arcpy.CopyFeatures_management(arcpy.ListFiles("*.shp")[counterXLS-1], outputFolderPath+"_"+anyValue+"_"+str(int(sheet.cell(15,7).value)))
#arcpy.AddMessage("list len")
#arcpy.AddMessage(len(list))
for j in arcpy.ListFiles("*.shp"):
counterSHP = counterSHP + 1
#arcpy.AddMessage("counterSHP value is ")
#arcpy.AddMessage(counterSHP)
#arcpy.AddMessage ("(counterXLS value is ")
#arcpy.AddMessage(counterXLS )
arcpy.AddMessage ("lenLIST")
arcpy.AddMessage (len(list))
upto = 0
for count in range(0,len(list)):
arcpy.AddMessage("count b4")
arcpy.AddMessage(count)
arcpy.AddMessage("LIST")
arcpy.AddMessage(list[count])
arcpy.AddMessage("considering INT")
arcpy.AddMessage(list[count][9:10])
arcpy.AddMessage("STRING")
arcpy.AddMessage(str(list[count])[:2])
if len(str(list[count]))== 12:
upto = 9
arcpy.AddMessage("in 12")
arcpy.AddMessage(str(list[count])[8:upto])
list2.append(str(list[count])[8:upto])
elif len(str(list[count]))== 13:
upto = 10
arcpy.AddMessage("in 13")
arcpy.AddMessage(str(list[count])[8:upto])
list2.append(str(list[count])[8:upto])
elif len(str(list[count]))== 14:
upto = 11
arcpy.AddMessage("in 14")
arcpy.AddMessage(str(list[count])[8:upto])
list2.append(str(list[count])[8:upto])
b=0
for countList2 in range(0,len(list2)):
b=countList2+1
for count1List2 in range(b,len(list2)):
#arcpy.AddMessage("countList2")
#arcpy.AddMessage(countList2)
#arcpy.AddMessage("count1List2")
#arcpy.AddMessage(count1List2)
if list2[countList2] == list2[count1List2]:
arcpy.AddMessage("DUP FOR")
arcpy.AddMessage(arcpy.ListFiles("*.shp")[countList2][:2])
arcpy.AddMessage("DUP WITH")
arcpy.AddMessage(arcpy.ListFiles("*.shp")[count1List2][:2])
arcpy.AddMessage("---END---")