Format column as Zip Code when exporting from ag-grid

180 views Asked by At

I am exporting to Excel using the Enterprise Ag-Grid built in solutions. Whenever I export a zipcode, any zipcode that begins with 0 loses that in the Excel file. I know that Excel supports a special Zip Code format, however, I keep striking out on my attempts.

        {
            headerName: 'ZIP',
            type: 'zip code',
            filter: 'number',
            unSortIcon: true,
            field: 'Zip',
            filterParams: {
                filterOptions: this.filterOption,
                clearButton: true,
                applyButton: true
            },
            minWidth: 120
        }

That is how the column is currently defined within the columnDefs of the gridOptions.

Thank you in advance for any assistance or insight you may have.

Regards,

Youssef

1

There are 1 answers

0
Michal Rosa On

You can format the required cells in your spreadsheet as "00000" which will show the required formatting. Format cells->Special->Zip Code.