so im using the SheetJs Library to read an excel file.
const data = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])
Wich returns Objects like this.
Ignoring the other properties.
The property rowNum is created by the sheet_to_json function and returns the Excel row Number of the Object.
I then use JSON.stringify
to create the JSON string of a single excel sheet. Wich i string concetate to a previous sheet.
this.convertedJson= this.convertedJson +JSON.stringify(data,undefined, 4);
Now the problem im encountering. After using .stringify()
i get returned every single property the different rows have, except rowNum.
This is the part of the output String for the Object above.
{
"WebShop": "AR_APPD-72642_RDS_RetailerUI_User",
"__EMPTY": "",
"__EMPTY_2": "AR RDS Retailer UI User (Prod)",
"__EMPTY_3": "AR RDS Retailer UI User (Prod) ",
"__EMPTY_4": "RtailerUI",
"__EMPTY_5": "RtailerAI"
}
I’ve found an older changelog of SheetJs, where ive noticed that the rowNum property was changed from enumerable to non-enumerable. Following up on that lead, apparently you cant serialize non-enumerable properties with .stringify(). Does anyone know a simple solution how i can still use .stringify() with non-enumerable properties. Or how i can change all rowNum properties of every object to enumerable?