Framework:Javascript Data GridAngular Data GridReact Data GridVue Data Grid

Angular Data Grid: Excel Export - Hyperlinks

This section describes how to insert hyperlinks in the cells of the exported Excel file.

Exporting Formulas

You can insert hyperlinks in the cells of the exported Excel file by outputting an Excel HYPERLINK formula with a URL value you provide. The code below inserts hyperlinks in the Excel export file for all values in the URL column.

<ag-grid-angular
    [columnDefs]="columnDefs"
    [defaultExcelExportParams]="defaultExcelExportParams"
    [excelStyles]="excelStyles"
    /* other grid options ... */>
</ag-grid-angular>

this.columnDefs = [
    { field: 'company' },
    { 
        field: 'url', 
        cellClass: 'hyperlinks' // references excel style 
    }
];
this.defaultExcelExportParams = {
    autoConvertFormulas: true,
    processCellCallback: params => {
        const field = params.column.getColDef().field;
        return field === 'url' ? `=HYPERLINK("${params.value}")` : params.value;
    }
};
this.excelStyles = [
    {
        id: 'hyperlinks',
        font: {
            underline: 'Single',
            color: '#358ccb'
        }
    }
];

Note the following:

  • The URL column of the grid below has URL values.
  • In the exported Excel file, the URL column has active links for these URL values.

Next Up

Continue to the next section: Master Detail.