I use xlsx in Node.js application to get the number of total rows. Here is the code
const range = xlsx.utils.decode_range(sheet['!ref']);
const totalRows = (range.e.r - range.s.r) + 1;
The problem is it also counts formatted cells with empty text. I only want to get number of rows with non-empty text. How can I do it using xlsx or is there any other library that can count number of rows containing non-empty text?
I know the thread is old but if anyone still looking for an answer, you can use the below code to ignore formatted blank cells:
var arr = xlsx.utils.sheet_to_row_object_array(sheet,{blankrows : false, defval: ''});
const totalRows = arr.length+1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With