# Displaying .csv file content in perspective

**URL:** <https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 31, 2024, 6:31pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214 "2024-05-31T18:31:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Hoover](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Josh\_Hoover](https://forum.inductiveautomation.com/u/Josh_Hoover)\
**Post date:** [May 31, 2024, 6:31pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/1 "2024-05-31T18:31:49Z")

</div>

Hello,

I need to display the contents of a .csv file in a table using perspective. Could anyone advise on some ways this can be accomplished?

Thanks,

---

<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:** [May 31, 2024, 6:33pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/2 "2024-05-31T18:33:00Z")

</div>

You need to use the file upload component to upload it to the gateway (even if only held in memory), then parse the CSV, translate it to an Ignition dataset or a list of dictionaries, then return that value to the session and display it in a table.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 31, 2024, 6:38pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/3 "2024-05-31T18:38:36Z")

</div>

> [@Upload csv to dataset](https://forum.inductiveautomation.com/t/upload-csv-to-dataset/79797/2):
>
> Figured it out, Not sure why I got hung up like I did. If anyone else gets stuck: the following class can parse csv files and store as a dataset: class CSVParser: def \_\_init\_\_(self, file\_in): self.file = file\_in self.file\_string = file\_in.getString() self.rows = [row.split(',') for row in self.file\_string.split('\r')] self.num\_cols = max([len(row) for row in self.rows]) self.num\_rows = len(self.rows) self.headers = self.rows[0] self.data = self.rows[1:] @property def extend…

Travis' code worked great for me when i needed to do this.

---

<div class="post-metadata">

**Author:** ![Josh\_Hoover](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Josh\_Hoover](https://forum.inductiveautomation.com/u/Josh_Hoover)\
**Post date:** [May 31, 2024, 7:42pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/4 "2024-05-31T19:42:40Z")

</div>

I'm a little confused on where to put the CSVParser class in ignition.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 31, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/5 "2024-05-31T19:44:52Z")

</div>

Put it in your script library

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/b/ab47eadd6fda50715189a42aa9bffa236fd02212.png)

---

<div class="post-metadata">

**Author:** ![Josh\_Hoover](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Josh\_Hoover](https://forum.inductiveautomation.com/u/Josh_Hoover)\
**Post date:** [May 31, 2024, 7:49pm UTC](https://forum.inductiveautomation.com/t/displaying-csv-file-content-in-perspective/91214/6 "2024-05-31T19:49:39Z")

</div>

Ah, thank you. That worked great. Much appreciated.
