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

eyalcohen4 picture eyalcohen4  路  3Comments

dullin picture dullin  路  3Comments

HachimDev picture HachimDev  路  3Comments

jamespan0 picture jamespan0  路  3Comments

magtuan picture magtuan  路  3Comments