# Print CSV not working

**URL:** <https://discourse.processing.org/t/print-csv-not-working/28045>\
**Category:** Coding Questions\
**Created:** [February 24, 2021, 9:34am UTC](https://discourse.processing.org/t/print-csv-not-working/28045 "2021-02-24T09:34:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xbix](https://avatars.discourse-cdn.com/v4/letter/x/ec9cab/32.png) [@xbix](https://discourse.processing.org/u/xbix)\
**Post date:** [February 24, 2021, 9:34am UTC](https://discourse.processing.org/t/print-csv-not-working/28045/1 "2021-02-24T09:34:42Z")

</div>

I am trying to load a CSV file and print the contents. The file loads and I get the filename, but the rows and columns are not passed.

Here is my code:

```auto
"use strict";

let i, k, trows, tcols;
let table, loadButton;

function setup() {
  createCanvas(800, 800);
  background(200);
  loadButton = createFileInput(gotFile);
  loadButton.position(20, 20);

}

function gotFile(f) {

  print(`File "${f.name}" of type "${f.type}" was chosen.`);

  table = loadTable(f.data, "csv");
  trows = table.getRowCount();
  tcols = table.getColumnCount();

  print(trows + " rows/lines in table ");
  print(tcols + " cols in table");

  for (i = 0; i < tcols; i++) {
    print("col: " + i + " " + table.getColumnTitle(i));
  }

  for (k = 0; k < trows; k++) {
    for (i = 0; i < tcols; i++) {
      print("row: " + k + " col: " + i + " string: " + table.getString(k, i));
    }
  }
}

```

the output of the console:

```auto
File "iris.csv" of type "" was chosen. 
SEP IS , 
0 rows/lines in table  
0 cols in table 

```

What am I doing wrong?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 24, 2021, 2:59pm UTC](https://discourse.processing.org/t/print-csv-not-working/28045/2 "2021-02-24T14:59:18Z")

</div>

can you post the link where you run it?

Or the first 10 lines of the csv please?

---

<div class="post-metadata">

**Author:** ![xbix](https://avatars.discourse-cdn.com/v4/letter/x/ec9cab/32.png) [@xbix](https://discourse.processing.org/u/xbix)\
**Post date:** [February 24, 2021, 3:57pm UTC](https://discourse.processing.org/t/print-csv-not-working/28045/3 "2021-02-24T15:57:11Z")

</div>

Thanks Chrisir, got it working now.  
Seems that the CSV format was not correct.
