# Perspective CSV File Upload Not Matching CSV File

**URL:** <https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974>\
**Category:** Ignition\
**Tags:** perspective, vision, python\
**Created:** [June 13, 2023, 6:55pm UTC](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974 "2023-06-13T18:55:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Reed.Schmidt](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@David.Reed.Schmidt](https://forum.inductiveautomation.com/u/David.Reed.Schmidt)\
**Post date:** [June 13, 2023, 6:55pm UTC](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974/1 "2023-06-13T18:55:20Z")

</div>

I'm attempting to import a csv file into Ignition using the file upload component in a perspective client. I created a super simple CSV file and saved as a CSV. I would like to print to the console the contents of every row but instead of getting every row I get what appears to be a number as in the byte representation of each character of the row. This should be simple enough and I do this sort of thing in vision without issue. I searched all through the forum and I cannot find a similar issue and the docs are not clear about how to proceed. I've played with different ways of doing the code and here is where it currently stands and the results. Any help would be appreciated.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/4/94f7c5c0f536cbfa898a41923433ea9fbfce7503.png)  
And this is what prints to the console:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/3/630ddf3339f322a98a959c347aadf7f9dcbbb885.png)  
But the CSV file looks like this  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/30b26db3523877443e9689ba3cd7ff4dda002f2a.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 13, 2023, 7:01pm UTC](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974/2 "2023-06-13T19:01:04Z")

</div>

`event.file.getBytes()` is returning, as the name implies, the byte array (binary) contents of the file.  
To decode it as text, you need to assume a character encoding, such as UTF-8. You need to make a string-like, file-like object for Python's `csv` module, which you can do with the StringIO module:

> [@Perspective onFileReceived - CSV](https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893/2):
>
> If you want to use Python’s built-in csv module, you need to construct a file-like object to pass to the reader. Luckily, Python also predicted the idea of interpreting a string in memory as a ‘file-like’ object, so the StringIO module already exists. What you want is probably something like this: from StringIO import StringIO fileContents = event.file.getString("UTF-8") reader = csv.DictReader(StringIO(fileContents)) for row in reader: print row
