Skip to content

Export Data from your Data Grid to file

With our data grid you can export your data to file.

There are three common ways to export data:

Export to CSV file

To export data to CSV file you need to use exporting option.

  • Setup exporting option on revo-grid to true:
<revo-grid exporting="true"/>
  • Access export plugin from plugin list:
const grid = document.querySelector('revo-grid');
grid.getPlugins().then(plugins => {
 plugins.forEach(p => {
   if (p.exportFile) {
       const exportPlugin = p;
       exportPlugin.exportFile({  filename: 'new file' });
   }
  })
});

Public methods

There are next methods available in export plugin and options object as FormatterOptions:

  • exportFile(options) - download file;
  • exportBlob(options) - export Blob object;
  • exportString(options) - get data string.

Options

General options are available for export:

ts
type FormatterOptions = {
  mime: string; // text/csv
  encoding: string;
  fileKind: string; // csv
  bom: boolean;
  columnDelimiter: string; // ','
  rowDelimiter: string; // '\r\n'
  filename?: string;
}

TIP

For the latest information it's recommended to read export-plugin file for better understanding of parameters and options.

Need richer spreadsheet export workflows? RevoGrid Pro Excel export creates workbook files that can preserve the visible grid layout, including column order, hidden columns, frozen panes, styles, merged cells, and formulas. Start with RevoGrid Pro or compare plans on Feature Comparison.

Need a lightweight browser-side PDF export button? Use @revolist/revogrid-pdf-export, a RevoGrid plugin powered by pdfmake. It exports visible rows and columns into a simple PDF table and supports grouped column headers. See PDF Export.