load

loads data from an external file

promise load(string url, [string format] );

Parameters

urlstringthe URL of an external file
formatstringoptional, the type of data to load: "json" (default), "csv", "xlsx"

Returns

promisea promise of data loading

Example

// load data in the JSON format (default)
spreadsheet.load("../common/data.json");
 
// load data in the CSV format
spreadsheet.load("../common/data.csv", "csv");
 
// load data in the Excel format, (.xlsx only)
spreadsheet.load("../common/data.xlsx", "xlsx");

Related samples

Details

The component will make an AJAX call and expect the remote URL to provide valid data.

Data loading is asynchronous, so you need to wrap any after-loading code into a promise:

spreadsheet.load("../some/data.json").then(function(){
    spreadsheet.selection.add(123);
});

Loading Excel data

Please note that the component supports import from Excel files with the .xlsx extension only.

dhtmlxSpreadSheet uses the WebAssembly-based library Excel2Json for import of data from Excel. Check the details.

See also
Back to top