| [ Web Proxy ] |
| Viewing: https://processing.org/reference/saveTable_.html | [Back] [Original] |
Writes the contents of a Table object to a file. By default, this file is
saved to the sketch's folder. This folder is opened by selecting "Show
Sketch Folder" from the "Sketch" menu.
Alternatively, the file can be saved to any location on the computer by
using an absolute path (something that starts with / on Unix and Linux, or
a drive letter on Windows).
All files loaded and saved by the Processing API use UTF-8encoding.
Table table;
void setup() {
table = new Table();
table.addColumn("id");
table.addColumn("species");
table.addColumn("name");
TableRow newRow = table.addRow();
newRow.setInt("id", table.getRowCount() - 1);
newRow.setString("species", "Panthera leo");
newRow.setString("name", "Lion");
saveTable(table, "data/new.csv");
}
// Sketch saves the following to a file called "new.csv":
// id,species,name
// 0,Panthera leo,Lion
saveTable(table, filename)saveTable(table, filename, options)table(Table)the Table object to save to afilefilename(String)the filename to which the Table should besavedoptions(String)can be one of "tsv", "csv", "bin", or"html"boolean
[Creative Commons License]This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
| Web Proxy Viewer | New URL | Original Page |