Export & Clipboard
Export Arrow
Export grid data to Apache Arrow using LyteNyte Grid's export API.
Apache Arrow provides the apache-arrow package for parsing and
creating Arrow tables. Install this package to enable exporting data to Arrow files.
npm install apache-arrowpnpm add apache-arrowyarn add apache-arrowbun add apache-arrowArrow Download
The demo below exports grid data to an Arrow file. Arrow is a binary format, so use an Arrow viewer to inspect the output.
To match Arrow’s columnar format, the code constructs an object of arrays,
with one array per column. It passes the object to tableFromArrays from
apache-arrow to create a table. Finally, it converts the table to a
byte buffer, wraps the buffer in a Blob, and downloads the file.
<button data-ln-button="tertiary" data-ln-size="md" onClick={async () => { const api = apiRef.current; if (!api) return;
const rect = await api.exportData();
const columns = Object.fromEntries(rect.columns.map((x) => [x.id, [] as any[]]));
for (let i = 0; i < rect.data.length; i++) { const data = rect.data[i];
for (let j = 0; j < rect.columns.length; j++) { const column = rect.columns[j]; columns[column.id].push(data[j]); } }
// TypeScript reports an error here, but the type is correct. const table = new Uint8Array(tableToIPC(tableFromArrays(columns), "file"));
downloadBlob(new Blob([table], { type: "application/vnd.apache.arrow.file" }), "data.arrow"); }}> Download Arrow File</button>Next Steps
- Export Parquet: Export grid data as a Parquet file.
- Export Excel: Implement Excel export using libraries like ExcelJS.
- CSV Data Export: Export grid data as a CSV file.
