# Really Basic CSV

**URL:** <https://rossvideo.community/t/really-basic-csv/8546>\
**Category:** Automation & Control\
**Created:** [February 10, 2021, 10:25am UTC](https://rossvideo.community/t/really-basic-csv/8546 "2021-02-10T10:25:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerryburianyk](https://rossvideo.community/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@jerryburianyk](https://rossvideo.community/u/jerryburianyk)\
**Post date:** [February 10, 2021, 10:25am UTC](https://rossvideo.community/t/really-basic-csv/8546/1 "2021-02-10T10:25:00Z")

</div>

Now for my next totally basic question re: dealing with really simple .CSV files (4items/10-20rows – Names/Titles etc). I just want to open a file (real path to the file – Drive:/Path1/Path2/Path3/File.csv ) or better yet, choose from a picker??

Populate a table or array with each value, then display it in an organized fashion.

Strangely, the part that I have the most problem with is just loading the file. Can anyone point me to video or tutorial that might help me out on this?

Thanks,  
Jerry

---

<div class="post-metadata">

**Author:** ![bengatien](https://rossvideo.community/letter_avatar_proxy/v4/letter/b/b5a626/32.png) [@bengatien](https://rossvideo.community/u/bengatien)\
**Post date:** [February 10, 2021, 6:24pm UTC](https://rossvideo.community/t/really-basic-csv/8546/2 "2021-02-10T18:24:00Z")

</div>

Take a look at the example panels here: [https://support.rossvideo.com/hc/en-us/community/posts/360065970252-Free-DashBoard-Example-Panels-for-Everyone,](https://support.rossvideo.com/hc/en-us/community/posts/360065970252-Free-DashBoard-Example-Panels-for-Everyone,%C2%A0)

In the Reading and Writing Files or Directories folder, there is an example on Reading a CSV File. It takes the content of the CSV and puts it into a structured parameter.

[#DashBoard](https://livinglive.community/search?s=tags%3A%22DashBoard%22&executesearch=true)

---

<div class="post-metadata">

**Author:** ![jerryburianyk](https://rossvideo.community/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@jerryburianyk](https://rossvideo.community/u/jerryburianyk)\
**Post date:** [February 11, 2021, 1:48am UTC](https://rossvideo.community/t/really-basic-csv/8546/3 "2021-02-11T01:48:00Z")

</div>

Thanks Ben, I do have those and they’ve shown me a lot - however even with the CSV example, there are some basics I apparently still don’t have.

I have no issues with the mechanics of the parsing etc. but I still don’t see how the file path is actually derived. As I mentioned, I’d like to see something like:  
Drive:/Path1/Path2/Path3/File.csv

but instead there is this:

ogscript.asyncPost(‘CSV Examples/CSV Reader Data.csv’, null, processCSV);

I get the needed script command and such – and see that the file is read from a subfolder but I don’t see the full path. I’d like to be in control of where the file is. I feel that I’m missing a basic concept here so if you could enlighten me, I’d appreciate it.

-Jerry

[#DashBoard](https://livinglive.community/search?s=tags%3A%22DashBoard%22&executesearch=true)

---

<div class="post-metadata">

**Author:** ![bengatien](https://rossvideo.community/letter_avatar_proxy/v4/letter/b/b5a626/32.png) [@bengatien](https://rossvideo.community/u/bengatien)\
**Post date:** [February 11, 2021, 2:03am UTC](https://rossvideo.community/t/really-basic-csv/8546/4 "2021-02-11T02:03:00Z")

</div>

‘CSV Examples/CSV Reader Data.csv’ is the path. In this case, it’s relative to the DashBoard folder, so it does not have the Drive:/ part of this. But you can put the whole path instead.

I just made a quick change to the example panel so that it’s getting the file path from a file parameter. Does that help?

Here is the code:

statecode county eq\_site\_limit hu\_site\_limit fl\_site\_limit fr\_site\_limit tiv\_2011 tiv\_2012 eq\_site\_deductible hu\_site\_deductible fl\_site\_deductible fr\_site\_deductible point\_latitude point\_longitude line construction policyID cols.0 cols.1 cols.2 cols.3 cols.4 cols.5 cols.6 cols.7 cols.8 cols.9 cols.10 cols.11 cols.12 cols.13 cols.14 cols.15 cols.16 function processCSV(fileContent) { if (fileContent == null) { ogscript.debug("CAN'T LOAD FILE"); return; }

var rows = fileContent.split(‘\n’);  
var dataByColumn = ; //It is more efficient if we only call “SET” on the parameters once

for (var r = 0; r \< rows.length; r++)  
{  
var cols = rows[r].trim().split(‘,’);  
for (var c = 0; c \< cols.length; c++)  
{  
if (c \>= dataByColumn.length)  
{  
dataByColumn.push(); //Add a new column if it wasn’t already created  
}  
dataByColumn[c][r] = cols[c].trim(); //Push the cell’s value into the array of column data at row “r”  
}  
}

//Now that we have collected all of the data for each column into an array, we can call setAllValues for the array parameter  
for (var c = 0; c \< dataByColumn.length; c++)  
{  
params.setAllValues(‘cols.’ + c, dataByColumn[c]); //Set all of the values in the column  
}  
}

ogscript.asyncPost(params.getValue(“filename”,0), null, processCSV);

[#DashBoard](https://livinglive.community/search?s=tags%3A%22DashBoard%22&executesearch=true)

---

<div class="post-metadata">

**Author:** ![jerryburianyk](https://rossvideo.community/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@jerryburianyk](https://rossvideo.community/u/jerryburianyk)\
**Post date:** [February 11, 2021, 4:08am UTC](https://rossvideo.community/t/really-basic-csv/8546/5 "2021-02-11T04:08:00Z")

</div>

Ben  
Extremely Helpful!  
-Jerry

[#DashBoard](https://livinglive.community/search?s=tags%3A%22DashBoard%22&executesearch=true)
