I am looking for a way to select a sheet within an Excel file as input to a Python Script tool in ArcGIS Pro. In the script, I am using GetParameterAsText. For the tool parameters I am using the File Data Type with the "xls;xlsx" extensions in the File Filter.
The input goes into the GetCount_management tool and then does a few other processes. The process fails with the first tool and gives the following error:
ERROR 000840: The value is not a Table View.
When you open the Make Table View geoprocessing tool and browse to the Input Table, it allows you to access the sheets. I am looking for this same functionality within a script tool. Thanks!
To enable the option to select sheets in the toolbox, you will have to use xlrd 1.1.0 : Python Package Index in the validation class of the tool. have done this in the past and it works "without problems", but before you are going this path, be aware with the most evil of all in software development... the user! Enabling them to use Excel to select a "table" as input data is providing them with the most powerful tool to make your life as software developer almost impossible. You may be lucky and have end-users that provide data well structured, but you will have to include numerous checks to see if the Excel data selected in your tool is valid to process in the rest of the code.