Sheetjs: How to skip first row of the excel

Created on 29 Aug 2016  路  2Comments  路  Source: SheetJS/sheetjs

How to skip the first row of the excel while parsing (in my excel first row contains some static text, header starts from second row), I have tried with option "sheetRows: 1" which is not working. is there any other alternate.

Most helpful comment

All of the utilities respect the !ref key as the range of the worksheet. You can directly manipulate it to control the sheet range.

For example, to skip the first row of a worksheet:

var range = XLSX.utils.decode_range(worksheet['!ref']);
range.s.r = 1; // <-- zero-indexed, so setting to 1 will skip row 0
worksheet['!ref'] = XLSX.utils.encode_range(range);

This range is respected by the various utility functions and exporters, as they all decode and work with the reported range.

Here's a live example: https://runkit.com/sheetjs/58f0158b09f0c50012171569

All 2 comments

sheetRows seems to be the number of rows you would like to parse, not an offset.

All of the utilities respect the !ref key as the range of the worksheet. You can directly manipulate it to control the sheet range.

For example, to skip the first row of a worksheet:

var range = XLSX.utils.decode_range(worksheet['!ref']);
range.s.r = 1; // <-- zero-indexed, so setting to 1 will skip row 0
worksheet['!ref'] = XLSX.utils.encode_range(range);

This range is respected by the various utility functions and exporters, as they all decode and work with the reported range.

Here's a live example: https://runkit.com/sheetjs/58f0158b09f0c50012171569

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lxzhh picture lxzhh  路  3Comments

upasana-shah picture upasana-shah  路  4Comments

gustavosimil picture gustavosimil  路  3Comments

goxr3plus picture goxr3plus  路  3Comments

DannyRyman picture DannyRyman  路  3Comments