Hey!
I check the documentation to find if there is an option to define row number of headers for the readFile method, and can't find one.
For example, I have a file with the first two rows empty (or include some unused data), and the 3rd row includes the headers.
I want to be able to:
XLSX.readFile(file, { header: 3 }
Is there a way to do so?
Thanks!
Will want to use the utils function XLSX.utils.sheet_to_json
The following should get the output you are looking for:
let sheet = workbook.Sheets["SheetWithData"]
let read_data = XLSX.utils.sheet_to_json(sheet, {header: 3})
Thanks again @harmon25 !
@eyalcohen4 there are two ways to do it: at the function level (like what @harmon25 showed) or at the worksheet level.
You can directly modify the worksheet range:
var range = XLSX.utils.decode_range(worksheet['!ref']);
range.s.r = 2; // or XLSX.utils.decode_row("3");
worksheet['!ref'] = XLSX.utils.encode_range(range);
Ok! Tnx a lot
Most helpful comment
Will want to use the utils function
XLSX.utils.sheet_to_jsonThe following should get the output you are looking for: