ngx-excel-export
ngx-excel-export copied to clipboard
How to hide/exclude columns while exporting
I don't want to include all the properties of an object while exporting.Could you please help me on how to exclude the required properties.
Simply use the .map()
function in javascript arrays before passing the objects to the export method, something like this:
const aux = json.map(el => ({ firstProperty: el.firstProperty, secondProperty: el.secondProperty })); this. exportAsExcelFile(aux, 'Test');
Imagine that the variable json
contained an array with objects like:
{ firstProperty: any, secondProperty: any, thirdProperty: any }
Then the thirdProperty
won't be printed in the Excel file
Thanks @adrianbenjuya will try it