LyteNyte Grid logo for light mode. Links back to the documentation home page.
Export & Clipboard

Export Excel

Export grid data to Excel using third-party libraries like ExcelJS.

Several open-source libraries can generate Excel files in JavaScript. This guide uses ExcelJS, but alternatives like SheetJs work with the same approach.

Excel Download

The demo below lets you download an Excel file containing all grid data. It uses ExcelJS to create a Blob and trigger the download.

Excel Export & Download

Fork code on stack blitzFork code on code sandbox

The implementation uses exportData to retrieve the current view of cells.

<button
onClick={async () => {
const api = apiRef.current;
if (!api) return;
const rect = await api.exportData();
downloadBlob(await getExcelFile(rect), "data.xlsx");
}}
>
Download Excel File
</button>

Next Steps