Skip to content

Import and export

Handsontable DataGrid exports its data to Excel (.xlsx) and CSV files, and imports Excel workbooks. Two plugins do the work, with no library to install: ExportFile writes files, and ImportFile reads them. This page shows which guide covers your task.

Pick a guide

TaskFormatPluginGuide
Download the grid as a workbook, with cell types, styling, and formulasXLSXExportFileExport to Excel
Load a workbook the user picked into the gridXLSXImportFileImport from Excel
Detect column types in CSV rows, pasted text, or API dataNone; rows in memoryImportFileInfer column types
Download the grid’s values as textCSVExportFileExport to CSV
Load a CSV fileCSVNone; the recipe parses it with PapaParseImport from CSV or Excel recipe
Download the grid as a PDF filePDFNone; the recipe uses jsPDFExport to PDF recipe
Copy and paste between the grid and other appsClipboardCopyPasteClipboard

Turn the plugins on

Both plugins are part of registerAllModules().

  • The ImportFile plugin is on unless you set importFile: false.
  • The ExportFile methods work whatever the exportFile value. Set exportFile to any value, for example exportFile: true, to add the Export item to the context menu.

Engines

Excel files are read and written by an engine. The built-in engine needs no library, and you can inject ExcelJS instead. XLSX engines compares the two and covers bundle size, limits, and security.

What a file cannot carry

A workbook can hold things the grid has no place for, such as pictures or pivot tables, and the grid can hold things an Excel file cannot store. Instead of failing, an import or export reports each one under a key, in a console warning and, for an import, on result.dropped. The Dropped features reference explains every key.

Related guides

Plugins