[][src]Static p5_sys::global::saveTable

pub static saveTable: SaveTableInternalType

Writes the contents of a Table object to a file. Defaults to a text file with comma-separated-values ('csv') but can also use tab separation ('tsv'), or generate an HTML table ('html'). The file saving process and location of the saved file will vary between web browsers.

Examples

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

Parameters

Table the Table object to save to a file

filename the filename to which the Table should be saved

options? can be one of "tsv", "csv", or "html"