Articles in this section
Category / Section

How to customize the Grid cell values while exporting in JavaScript?

1 min read

You can customize the default cell values before excel exporting the JavaScript Grid by using the “excelHeaderQueryCellInfo” and “excelQueryCellInfo” events. You can do the same for pdf export by using the “pdfHeaderQueryCellInfo” and “pdfQueryCellInfo” events.

This is demonstrated in the below sample code in which the header and content cell values are customized before exporting using the corresponding query cell info events.


exportQueryCellInfo = function(args) {
  if ( == 'excelHeaderQueryCellInfo' || =='pdfHeaderQueryCellInfo') {
    console.log(args.cell.value); // here you can get header cell value
    if (args.cell.value == 'Order ID') {
      args.cell.value = 'Changed';
  if ( == 'excelQueryCellInfo' || == 'pdfQueryCellInfo') {
    console.log(args.value); // here you can get content cell value
    if (args.value == 'VINET') {
      args.value = 'Changed';
var grid = new ej.grids.Grid({
  dataSource: window.orderDatas,
  allowExcelExport: true,
  allowPdfExport: true,
  excelQueryCellInfo: exportQueryCellInfo,
  excelHeaderQueryCellInfo: exportQueryCellInfo,
  pdfQueryCellInfo: exportQueryCellInfo,
  pdfHeaderQueryCellInfo: exportQueryCellInfo,
  toolbar: ['ExcelExport', 'PdfExport', 'CsvExport'],
  columns: [
      field: 'OrderID',
      headerText: 'Order ID',
      width: 120,
      textAlign: 'Right',
    { field: 'CustomerID', headerText: 'Customer ID', width: 150 },
      field: 'OrderDate',
      headerText: 'Order Date',
      width: 130,
      format: 'yMd',
      textAlign: 'Right',
    { field: 'Freight', width: 120, format: 'C2', textAlign: 'Right' },
grid.toolbarClick = function(args) {
  if ( === 'Grid_pdfexport') {
  if ( === 'Grid_excelexport') {
  if ( === 'Grid_csvexport') {



Customizing cell values while exporting


JavaScript Demo

Angular Demo

React Demo


I hope you enjoyed learning about how to customize the Grid cell values while exporting.

You can refer to our JavaScript Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.  You can also explore our  JavaScript Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment