SheetJS json_to_sheet renaming headers

Kay Singian picture Kay Singian · Sep 7, 2018 · Viewed 12.8k times · Source

I have an array of objects. By default, sheet_to_json uses object keys as headers. However, I need to rename those headers without explicitly modifying my array of objects.

Is this possible?

Answer

Peilin Zhai picture Peilin Zhai · Feb 24, 2020

replace the last line with below.

XLSX.utils.sheet_add_json(ws, data, {skipHeader: true, origin: "A2"});