-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path28_June_7_15PM.txt
More file actions
79 lines (61 loc) · 2.52 KB
/
28_June_7_15PM.txt
File metadata and controls
79 lines (61 loc) · 2.52 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
import arcpy
import xlrd
import array
from array import *
counterSHP = 0
counterXLS = 0
check = 0
list = []
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 )
for num in range(0,counterXLS):
for num1 in range(1,counterXLS):
if list[num-1] == list[num1]:
arcpy.AddMessage ("NUM")
arcpy.AddMessage (num-1)
arcpy.AddMessage ("NUM1")
arcpy.AddMessage (num1)
arcpy.AddMessage ("GOTTAA!!")
arcpy.AddMessage ("name of cluster file is : ")
arcpy.AddMessage (arcpy.ListFiles("*.shp")[num-1][:2])
arcpy.AddMessage ("for value ")
arcpy.AddMessage (list[num-1])
arcpy.AddMessage ("lenLIST")
arcpy.AddMessage (len(list))
#arcpy.CopyFeatures_management(A, B)