Importing Local CSV

I'm trying to import a local CSV to serve as a reference table on a component in perspective. I've run this line in both the script console and as part of a script that runs on the component:

	filePath = "C:/myfile.csv"
	isFile = system.file.fileExists(filePath)

In the console, isFile returns True. When run on a component script, it returns False. I think that this is because of the restricted access in Perspective. Is there a way to write my data to the component from the script console? This only needs to be done once. Any other ideas for making a static table that a component can reference (other than manually creating and filling in a table) would be appreciated.

Scripts in Perspective are run on the gateway. The script console is running code on your local computer.
You wont directly be able to access a file on your local machine in perspective, you would need to upload it to the gateway, or otherwise make the data accessible to the gateway.

1 Like

How can I upload it to the gateway? FileUpload Component?

Yes, that would work.

2 Likes

I copied @Travis_Opperud's code from here, which quite nicely parses the csv from the file upload without needing to save the file to the gateway's disk.

1 Like