Reading from .csv file to table

Not sure if I should start a new thread, but it seems related to this one.

I can write the same code that everyone else has above into the script console and it works fine, makes a dataset:

path = 'J:\Industrial Engineering\Productivity Reporting\PDC\Real-time reports\Production\KitFamilySKUs - KenCSV.csv'
import csv
csvData = csv.reader(open(path))
header =
# Create a dataset with the header and the rest of our CSV.
dataset = system.dataset.toDataSet(header ,list(csvData))

I then tried to put this code into a Perspective change script, realized that wouldn't work because I need file upload component instead.

So I then tried it in a gateway change script, and in a tag change script. Both of them seem to fail at

csvData = csv.reader(open(path))

but I don't see any error messages in the console.

What would be the difference here between running it in script console and running on the gateway?


When you run it in the script console it executes on the computer running the Designer.

When you run it in the gateway scope it executes on the computer running the Gateway.

1 Like

Thanks Kevin. I've read this a thousand times on the forum, but it didn't register that it was also true of file opening.

So I realized that the network drive I was trying to read from was mounted on my PC where I am using designer, but not on the server that hosts Ignition. So with renewed hope, I mounted this share on the hosting server and still nothing. Can't read it, and it doesn't exist according to system.file.fileExists().

I can ping the share from the server, and I can read the file from a command window, but from Ignition I can't. Ignition can see a file that I store locally on the server, but I can't see it on the network mounted drive.

This is a Windows server, and I am logged in with the same credentials that Ignition is using.

Any other ideas?


Mounted according to whom? Unless you went through this process: Mapping a Network Drive - Ignition User Manual 8.1 - Ignition Documentation, your network drive is still not visible to the gateway service.


Ah ha, it's always something else! The gateway can see it now, but the service can't!

Thanks for that helpful tidbit. I implemented what you pasted, and now my gateway and the Ignition service are now able to see this mounted drive.



This works well.
Thank you very much Jorden