Consider buying the native Tablecruncher desktop application:
Available for macOS (Windows coming soon)
Tablecruncher is a free online CSV editor. Some features require a paid subscription:
Tablecruncher can only load CSV files from a server if this server explicitely allows to do so. To enable remote loading, the server must have CORS enabled for tablecruncher.com or for any domain.
Dropbox, for example, allows remote loading of files when using dl.dropboxusercontent.com as the domain name. If you're providing a typical www.dropbox.com URL, Tablecruncher is silently requesting the file from dl.dropboxusercontent.com to prevent a CORS error.
To run Javascript macros, there's a single object Tablecruncher
. This object has the following
static methods:
active()
: Returns an instance of the currently opened and displayed document
new()
: Opens a new (empty) document and returns an instance of this new document
open(url)
: Tries to load a CSV file from the given URL (read about CORS)
setOption(key, value)
: Set global options. Only option supported is storage-mode
log(...msg)
: Write all arguments to the log area
clearLog()
: Clear the log area
The methods active()
, new()
and open(url)
return an object, representing
a CSV document. To work with this document, the document object provides several methods:
rows()
: Returns the number of rows in this document (a custom header row is not counted)
columns()
: Returns the number of columns in this document
get(row, column)
: Returns the content of the cell at row and column as a string
set(row, column, value)()
: Set the content of the cell at row and column
deleteColumn(column)
: Deletes a single columnt at column
mergeColumns(column_1, column_2, glue)
: Concatenate the content of column_1 and column_2 and
write the result into column_1. If a glue string is provided, it's put between both values.
column_2 remains unchanged.
renameColumn(column, new_name)
: If a custom header is set, set a new name for column
deleteRow(row)
: Delete the single row with zero-based row index row
selection()
: Returns an object with the current selection. Example:
{fromRow: 0, toRow: 2, fromColumn:3, toColumn:5}
isEmptyRow(row)
: Returns true if the row is empty, false otherwise
Where a column has to be passed to a method, you can provide a zero-based index or the header name of that column if a custom header row is set. You can't use generic header names like 'A' (column 0) or 'AC' (column 28).
A row is always expected as a zero-based index. The first (non-header) row has index 0, even when it's shown as row "1" in the editor. A custom header row is not counted when calculating the row index. This means, the row index will change when you toggle the "[ ] Header" switch in the toolbar.
let doc = Tablecruncher.active()
for(let r = 0; r < doc.rows(); ++r) {
for(let c = 0; c < doc.columns(); ++c) {
let cell = parseFloat( doc.get(r, c) )
if( !isNaN(cell) ) {
doc.set(r, c, cell + 1)
}
}
}
let doc = Tablecruncher.active()
let selection = doc.selection()
for(let r = selection.fromRow; r <= selection.toRow; ++r) {
for(let c = selection.fromColumn; c <= selection.toColumn; ++c) {
doc.set(r, c, 42)
}
}
Only works if an appropriate CORS header is set.
Tablecruncher.open("https://www.dropbox.com/s/qynqymjtjrqqsa6/animal-speeds.csv")
.then(doc => {
console.log(doc.rows())
doc.set(0, 1, "CHANGED")
})
Tablecruncher.com is a project of:
Stefan Fischerländer
Asamstr. 23
94486 Osterhofen
Germany
Telefon: +49 9932 4005996
E-Mail: info@tablecruncher.com
Contact, legal and privacy information:
Contact & Legal