0

In a custom toolbox you can make a parameter and ask user for input where he can type something and used as arcpy.GetParameterAsText(0) in the script in the toolbox. This is good if you want to use address of a folder but what if needs to select a csv file?

One way would be:

  • User types the folder path and the script will add + file.csv

Example code:

import arcpy
import pandas as pd
file = arcpy.GetParameterAsText(0)
df = pd.read_csv(file)

In this case the user will be asked to select a path when using the toolbox. To do this he just copies the path of the folder the csv is. Then he must add manually to the path the: ex. \pop2012.csv.

1

The answer is to select file in parameters in the properties of the toolbox. Then it enables you to select a file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.