'Angular 13 ag-grid prependContent

Am working on Angular ag grid APIs

I need to add a summary header with data in my exported csv files. Now i can able to add summary header with the help of prependContent

code

const params = {
      fileName: 'table-template',
      prependContent: 'Colum1,Colum2,Colum3',
    };
    this.gridApi.exportDataAsCsv(params);

Now i can generate the csv like below

enter image description here

How can i include value as well

enter image description here

Edit 1

ag grid document says

With prependContent=CsvCell[][] or appendContent=CsvCell[][], custom content will be inserted containing commas and quotes. These commas and quotes will be visible when opened in Excel because they have been escaped properly.

How can we use CsvCell[][].

How can i modify my prependContent.

Thanks in advance



Solution 1:[1]

I have added below array into prependContent,Now its working as expected.

      [
        [],
        [{data: { value: 'Colum1:', type: 'String'}},
         {data: { value: '100', type: 'String' }},
        ],
        [],
      ],

The blank array will make a new empty row

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 arj