Is it possible to access and use a csv file via Python scripts?

Category:
Scripts
Summary

I have created a csv file that contains information on the system and I would like to be able to use it via Python in order to make some changes.

Answer

There are several ways to access a csv file via Python. In this example the csv file is managed as document in the StationWare library and will be accessed by the script using the document ID. The document ID can be found by hovering with the mouse over the document object in the library and depending on the browser, the ID will be displayed, e.g. in the bottom left browser corner (fid=xxxx).

The library document can be accessed by using the service method DocumentGetContent(ID). For further working and processing with the csv file the standard Iron Python methods can be used.

csvDocument=Service.DocumentGetContent("38174")
textOfCSV=str(bytes(csvDocument))
csvData=csv.reader(textOfCSV.split('\n'), delimiter=';')

for row in csvData:

do some coding by using row after row stored information

Back