ngx-excel-export icon indicating copy to clipboard operation
ngx-excel-export copied to clipboard

How to hide/exclude columns while exporting

Open yaswanthkata opened this issue 7 years ago • 2 comments

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.

yaswanthkata avatar Feb 19 '18 12:02 yaswanthkata

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

adrianbenjuya avatar Feb 26 '18 15:02 adrianbenjuya

Thanks @adrianbenjuya will try it

yaswanthkata avatar Feb 28 '18 10:02 yaswanthkata