Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Column Order

I was wondering if there is a way to specify the column order in an excel spreadsheet when exported as the json output from my webservice might return the data not in the desired format. Also is there a way to format column like money etc ? Last one can the Header name be set to something else then the field name of the json doc ? for example i have a field called customer_name and i want in the header to show Names ?

No Data
  • 60
    Offline posted

    Hi Alex,

    Thank you for contacting Infragistics!

    The `IgxExcelExporterService` exports the array of objects that you've passed. To change the order, you can simply map the array with a transform function before passing it to the `exportData` method:

    const arrangeData: (obj: { [key:string] : any}) => {[key: string]: any} = (obj) => {
    //Return an object with the mapped keys in proper order
      return {
      age: obj.age,
      uid: obj.uid

    You can change the date that will be populated in the cells by subscribing to the `onRowExport` event and changing the data that you want to write:

    this.excelExportService.onRowExport.pipe(takeUntil(this.destroy$)).subscribe((args: IRowExportingEventArgs) => {
          args.rowData["account_balance"] = '$' + args.rowData["account_balance"].toFixed(2);

    In the above example, `rowData.account_balance` is changed from `number` to `string`, with an appended dollar sign to the beginning. 

    As for the headers, you can subscribe to the `onColumnExport` event and change the header of the column that is being exported:

    this.excelExportService.onColumnExport.pipe(takeUntil(this.destroy$)).subscribe((args: IColumnExportingEventArgs) => {
          if (args.field === "uid") {
            args.header = "Unique ID";

    Here is a StackBlitz example - please have a look when you get the chance!

    I hope this helps!