# Perspective onFileReceived - CSV

**URL:** <https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893>\
**Category:** Ignition\
**Created:** [October 21, 2020, 7:41pm UTC](https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893 "2020-10-21T19:41:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [October 21, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893/2 "2020-10-21T20:29:49Z")

</div>

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:

```auto
from StringIO import StringIO

fileContents = event.file.getString("UTF-8")
reader = csv.DictReader(StringIO(fileContents))

for row in reader:
	print row

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893)._
