I am trying to pass in an excel spreadsheet as in input into my script tool using arcpy.GetParametersAsText()
The script does post processing on the spreadsheet, the script itself works when it is run with hard coded file paths. However, I cannot seem to find the correct parameter data type to give to the tool in ArcGIS Pro. This tool takes in 2 files, one is a csv which it has no problem taking. The other is the excel spreadsheet which arc recognizes but only as a file that is holding a table. I cannot get arc to pass the whole file into the tool.
Any suggestions would be useful.
Thanks,
J
Solved! Go to Solution.
Well, in my excel to table, I used Any Value, so give it a shot if you don't want to navigate to a sheet
If you just want to point to an excel file (and not a sheet/range within the file) use the FILE data type, and then set the filter to XLSX.
Try workspace, then you have to read the sheet name
python - Reading Excel sheet in ArcPy script? - Geographic Information Systems Stack Exchange
Alternately, just get the filename and you can use the xlrd module directly
My issue is the data type parameter when making the script tool. I can't find the correct parameter type that will just pass in the excel file. Basically it needs to be passed in as a filepath.
There is no issues with my script, it runs and processes as intended. Arc just won't allow me to give the filepath to the spreadsheet.
Hopefully this screenshot will help. With the MSAG_Current as a file, arc will see the xl spreadsheet but asks me to open it, because it wants the table inside. Which isn't what my script wants, all the script wants is the filepath.
Thank you Dan.
Well, in my excel to table, I used Any Value, so give it a shot if you don't want to navigate to a sheet
Well, if I navigate to the xlsx file using Any Value it still wants to open up to the table. But if I use the path to the table I just delete the table from the path and the script runs. That may be the best I get.
ESRI should have a XLSX parameter in my opinion, but hey that's why they pay me the small bucks. 🙂
Thank you Dan.
If you just want to point to an excel file (and not a sheet/range within the file) use the FILE data type, and then set the filter to XLSX.