# Importing CSV file from Server

**URL:** <https://forum.inductiveautomation.com/t/importing-csv-file-from-server/18712>\
**Category:** Ignition\
**Created:** [July 3, 2018, 6:06pm UTC](https://forum.inductiveautomation.com/t/importing-csv-file-from-server/18712 "2018-07-03T18:06:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccoker](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@ccoker](https://forum.inductiveautomation.com/u/ccoker)\
**Post date:** [July 3, 2018, 6:06pm UTC](https://forum.inductiveautomation.com/t/importing-csv-file-from-server/18712/1 "2018-07-03T18:06:25Z")

</div>

I’m somewhat new to Ignition and I’m trying to create scripting that will allow me to pull a csv file from a linked server and display the excel table in a power table in Ignition. Does this scripting look correct?:

#Ask the user to find the CSV in the local file system  
path = system.file.openFile (“C:\File\formulas.csv”)

#Use readFileAsString to read the contents of the file as a string.  
stringData = system.file.readFileAsString (path)

#Convert the string into a dataset  
data = system.dataset.fromCSV(stringData)

#Pass the dataset to the data property on the Power Table  
event.source.parent.getComponent(‘Power Table’).data = data

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 3, 2018, 6:39pm UTC](https://forum.inductiveautomation.com/t/importing-csv-file-from-server/18712/2 "2018-07-03T18:39:39Z")

</div>

It’s a good start, but I’d say, unfortunately, probably not.

_ **system.dataset.fromCSV** _ requires extra info at the top of the file. If the csv file is generated from Excel (this is only based on the mention of it in your post), then that information won’t be there.

One more item I can see is that you will get an error if the **_system.file.openFile_** dialog is closed without picking a path.

[https://docs.inductiveautomation.com/display/DOC79/system.dataset.fromCSV](https://docs.inductiveautomation.com/display/DOC79/system.dataset.fromCSV)  
[https://docs.inductiveautomation.com/display/DOC79/system.file.openFile](https://docs.inductiveautomation.com/display/DOC79/system.file.openFile)

---

<div class="post-metadata">

**Author:** ![ccoker](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@ccoker](https://forum.inductiveautomation.com/u/ccoker)\
**Post date:** [July 3, 2018, 7:01pm UTC](https://forum.inductiveautomation.com/t/importing-csv-file-from-server/18712/3 "2018-07-03T19:01:50Z")

</div>

Thanks for the reply Jordan! No this csv file is being exported by a piece of equipment to a specific folder location.

Looking at the first link, I think I’ll use:

# In this example it is assumed that the CSV file being read was a dataset that was previously exported using system.dataset.toCSV:

# Specify file path

file\_path = “C:\my\_dataset.csv”

# Read in the file as a string

data\_string = system.file.readFileAsString(file\_path)

# Convert the string to a dataset and store in a variable

data = system.dataset.fromCSV(data\_string)

# Assign the dataset to a table

event.source.parent.getComponent(‘Table’).data = data

Thanks Jordan
