Skip to main content

load()

loads data from an external file

load: (url: string, type?: string) => Promise<any>;

Parameters:

  • url: string - the URL of an external file
  • type: string - optional, the type of data to load: "json" (default), "csv", "xlsx"

Returns:

A 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 sample: Spreadsheet. Load Data

Related sample: Spreadsheet. CSV Load

Related sample: Spreadsheet. Import Xlsx

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

note

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

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

Related articles

Data loading and export