Products

Methods

Jspreadsheet has a comprehensive number of native methods to programmatically interact with your javascript spreadsheet and its data.

Go to a working example

General Methods

Method Description Example
getData Get the full or partial table data
@Param boolean onlyHighlighedCells - Get only highlighted cells
spreadsheet.getData([bool]);
getJson Get the full or partial table data in JSON format
@Param boolean onlyHighlighedCells - Get only highlighted cells
spreadsheet.getJson([bool]);
getRowData Get the data from one row by number
@Param integer rowNumber - Row number
spreadsheet.getRowData([int]);
setRowData Set the data from one row by number
@Param integer rowNumber - Row number
@Param array rowData - Row data
spreadsheet.setRowData([int], [array]);
getColumnData Get the data from one column by number
@Param integer columnNumber - Column number
spreadsheet.getColumnData([int]);
setColumnData Set the data from one column by number
@Param integer columnNumber - Column number
@Param array colData - Column data
spreadsheet.setColumnData([int], [array]);
setData Set the table data
@Param json newData - New JSON data, null will reload what is in memory.
spreadsheet.setData([json]);
setMerge Merge cells
@Param string columnName - Column name, such as A1.
@Param integer colspan - Number of columns
@Param integer rowspan - Number of rows
spreadsheet.setMerge([string], [int], [int]);
getMerge Get merged cells properties
@Param string columnName - Column name, such as A1.
spreadsheet.getMerge([string]);
removeMerge Destroy merged by column name
@Param string columnName - Column name, such as A1.
spreadsheet.removeMerge([string]);
destroyMerged Destroy all merged cells spreadsheet.destroyMerge();
getCell Get current cell DOM
@Param string columnName - String compatible with Excel, or as object.
spreadsheet.getCell([string]);
getLabel Get current cell DOM innerHTML
@Param string columnName - String compatible with Excel, or as object.
spreadsheet.getLabel([string]);
getValue Get current cell value
@Param mixed cellIdent - String compatible with Excel, or as object.
spreadsheet.getValue([string]);
getValueFromCoords Get value from coordinates
@Param integer x
@Param integer y
spreadsheet.getValueFromCoords([integer], [integer]);
setValue Change the cell value
@Param mixed cellIdent - String compatible with Excel, or as object.
@Param string Value - New value for the cell
@Param bool force - Update readonly columns
spreadsheet.setValue([string], [string], [bool]);
setValueFromCoords Set value from coordinates
@Param integer x
@Param integer y
@Param string Value - New value for the cell
@Param bool force - Update readonly columns
spreadsheet.setValueFromCoords([integer], [integer], [string], [bool]);
resetSelection Reset the table selection
@Param boolean executeBlur - Execute the blur from the table
spreadsheet.resetSelection([bool]);
updateSelection Select cells
@Param object startCell - Cell object
@Param object endCell - Cell object
@Param boolean ignoreEvents - Ignore onselection event
spreadsheet.updateSelection([cell], [cell], true);
updateSelectionFromCoords Select cells
@Param integer x1
@Param integer y1
@Param integer x2
@Param integer y2
spreadsheet.updateSelectionFromCoords([integer], [integer], [integer], [integer]);
getWidth Get the current column width
@Param integer columnNumber - Column number starting at zero
spreadsheet.getWidth([integer]);
setWidth Change column width
@Param integer columnNumber - Column number starting at zero
@Param string newColumnWidth - New column width
spreadsheet.setWidth([integer], [integer]);
getHeight Get the current row height
@Param integer rowNumber - Row number starting at zero
spreadsheet.getHeight([integer]);
setHeight Change row height
@Param integer rowNumber - Row number starting at zero
@Param string newRowHeight - New row height
spreadsheet.setHeight([integer], [integer]);
getHeader Get the current header by column number
@Param integer columnNumber - Column number starting at zero
spreadsheet.getHeader([integer]);
getHeaders Get all header titles spreadsheet.getHeaders();
setHeader Change header by column
@Param integer columnNumber - Column number starting at zero
@Param string columnTitle - New header title
spreadsheet.setHeader([integer], [string]);
getStyle Get table or cell style
@Param mixed - Cell identification or null for the whole table.
spreadsheet.getStyle([string]);
setStyle Set cell(s) CSS style
@Param mixed - JSON with whole table style information or just one cell identification. Ex. A1.
@Param k [optional] - CSS key
@Param v [optional] - CSS value
spreadsheet.setStyle([object], [string], [string]);
resetStyle Remove all style from a cell
@Param string columnName - Column name, example: A1, B3, etc
spreadsheet.resetStyle([string]);
getComments Get cell comments
@Param mixed - Cell identification or null for the whole table.
spreadsheet.getComments([string]);
setComments Set cell comments
@Param cell - Cell identification
@Param text - Comments
spreadsheet.setComments([string], [string]);
orderBy Reorder a column ascending or descending
@Param integer columnNumber - Column number starting at zero
@Param smallint sortType - One will order DESC, zero will order ASC, anything else will toggle the current order
spreadsheet.orderBy([integer], [boolean]);
getConfig Get table definitions spreadsheet.getConfig();
insertColumn Add a new column
@Param mixed - Number of columns to be added or data to be added in one single column
@Param int columnNumber - Number of columns to be created
@Param boolean insertBefore
@Param object properties - Column properties
spreadsheet.insertColumn([mixed], [integer], [boolean], [object]);
deleteColumn Remove column by number
@Param integer columnNumber - Which column should be excluded starting at zero
@Param integer numOfColumns - Number of columns to be excluded from the reference column
spreadsheet.deleteColumn([integer], [integer]);
moveColumn Change the column position
@Param integer columnPosition
@Param integer newColumnPosition
spreadsheet.moveColumn([integer], [integer]);
insertRow Add a new row
@Param mixed - Number of blank lines to be inserted or a single array with the data of the new row
@Param integer rowNumber - Reference row number
@Param boolean insertBefore
spreadsheet.insertRow([mixed], [integer], [boolean]);
deleteRow Remove row by number
@Param integer rowNumber - Which row should be excluded starting at zero
@Param integer numOfRows - Number of lines to be excluded
spreadsheet.deleteRow([integer], [integer]);
moveRow Change the row position
@Param integer rowPosition
@Param integer newRowPosition
spreadsheet.moveRow([integer], [integer]);
download Get the current data as a CSV file
@Param bool - True to download parsed formulas.
spreadsheet.download([bool]);
getMeta Get the table or cell meta information
@Param mixed - Cell identification or null for the whole table.
spreadsheet.getMeta([string]);
setMeta Set the table or cell meta information
@Param mixed - JSON with whole table meta information.
spreadsheet.setMeta([mixed]);
fullscreen Toggle table fullscreen mode
@Param boolean fullscreen - Define fullscreen status as true or false
spreadsheet.fullscreen([bool]);
getSelectedRows Get the selected rows
@Param boolean asIds - Get the rowNumbers or row DOM elements
spreadsheet.getSelectedRows([bool]);
getSelectedColumns Get the selected columns spreadsheet.getSelectedColumns();
showIndex Show column of index numbers spreadsheet.showIndex();
hideIndex Hide column of index numbers spreadsheet.hideIndex();
search Search in the table, only if directive is enabled during initialization.
@Param string - Search for word
spreadsheet.search([string]);
resetSearch Reset search table spreadsheet.resetSearch();
whichPage Which page showing on Jspreadsheet - Valid only when pagination is true. spreadsheet.whichPage();
page Go to page number - Valid only when pagination is true.
@Param integer - Go to page number
spreadsheet.page([integer]);
undo Undo last changes spreadsheet.undo();
redo Redo changes spreadsheet.redo();