Exporting AG Grid to Excel

  |   Misc

Exporting to Excel is a core feature in AG Grid, frequently used by our customers. In this post we'll review the major features in Excel export. Full details of the export functionality is available in the documentation.

These features are available without requiring the need for an additional Excel Export Javascript Library.

Using Excel Export

Excel Export is an enterprise feature and is enabled by default for users from the Context Menu.

The Excel Export immediately provides users with the ability to export their tables content in the HTML page to Excel.

It is possible to achieve finer grained control over Excel export using the Grid API.

gridOptions.api.exportDataAsExcel();

Exporting Styles

Styles can be applied to the exported spreadsheet that work independently of the styles applied to the grid.

Exporting Images

Exporting images is fully supported - rendering the image in an Excel cell all by itself or together with text. You can find more information about this in our documentation and a live sample below:

Exporting formulas into Excel files is now fully supported. For any cell in AG Grid you can provide the formula value to be used when exporting that cell to Excel. This allows to export values as hyperlinks in the Excel export. You can find more information about this in our documentation and a live sample below:

Exporting into Multiple Sheets

Exporting grid data into multiple sheets of the same Excel file is now fully supported. You can create the sheets you need in the exported file and provide the content to be exported on each sheet. This is especially useful when you have different datasets that you'd like to keep on separate sheets but still packaged in the same Excel file. You can find more information about this in our documentation and a live sample below:

Exporting additional content

Starting with AG Grid 25.2 you can export additional content alongside AG Grid. You can add text and images on the same sheet alongside the AG Grid export, or on separate sheets to build a cover page. You can also set the header and footer content for the Excel workbook which is useful when printing, providing the document title, current page number, author on each page.

You can find more information about this in our documentation and a live sample below:

Exporting Date values

We've added support for exporting date values so these values are entered and formatted correctly as dates in Excel. You can find more information about this in our documentation and a live sample below:

Controlling Page Setup

If you're printing your Excel exports, it's helpful to be able to configure the page setup including the page size, orientation and margins. You can now do this to get files that are ready to be printed without any additional adjustments by the user. You can find more information about this in our documentation and a live sample below:

Additionally

We continually expand the functionality of the Excel Export and support:

  • Exporting of Master/Detail views for embedded grids
  • Row Grouping so that grouped tree items are exported as expandable row groups

Many more features are listed in our Excel Export Documentation.

Summary

We hope you find this article useful to understand the rich export to Excel functionality available in AG Grid. There is significant additional export functionality I've not covered here such as exporting with styles, export settings for rows, columns and exporting master-detail grids.

This is why I would recommend looking for additional information and examples related to export to Excel in our documentation.

If you would like to try out ag-Grid check out our getting started guides (JS / React / Angular / Vue)

Happy coding!

Read more posts about...