Savetable with P5

Hello,

I used this example:

https://p5js.org/reference/#/p5/saveTable

I edited it:

let table;

 function setup() {
 table = new p5.Table();

// table.addColumn('id');
 //table.addColumn('species');
 //table.addColumn('name');

 //let newRow = table.addRow();
// newRow.setNum('id', table.getRowCount() - 1);
 //newRow.setString('species', 'Panthera leo');
// newRow.setString('name', 'Lion');

 // To save, un-comment next line then click 'run'
  saveTable(table, 'new.csv');
 }

 // Saves the following to a file called 'new.csv':
 // id,species,name
 // 0,Panthera leo,Lion

It saves a csv file.

This works as well:

 saveTable(table, 'new', 'csv');

Google Chrome was used along with https://editor.p5js.org/

1 Like