Lattice Grid Buy a licence

developer guide

CSV Import into a JavaScript Data Grid

Import brings rows in from a CSV or a spreadsheet file, either through a control the reader uses or through grid.import from your own code, so loading data is part of the screen rather than a separate upload page.

Developer guideExport and clipboard › CSV Import into a JavaScript Data Grid

Import

The mirror of export: rows coming in from a CSV or TSV file, a drop, or a pasted spreadsheet block. The pipeline is parse, infer each column's type, map the columns onto your fields, then preview and confirm - nothing lands until the user says so.

Preview, then confirm

// Parse and map without touching the grid - this is what the dialog shows.
const preview = grid.import.preview(csvText);
// preview.columns is the mapping the user can edit; preview.warnings flags a
// ragged file. Confirming appends (or, with { mode: 'replace' }, swaps).
grid.import.apply(preview);

Set config.import to true to add the DOM affordances - a "Import rows from CSV…" cell-menu item, a file drop target, and paste - each opening the same preview dialog. The grid.import API is present whether or not you do, so a server-side or headless import runs the identical pipeline. .xlsx is not read (it needs an inflate and XML reader the zero-dependency envelope does not carry); save the sheet as CSV.