DaSpawn / xlsx-stream-reader

Memory efficinet minimalist non-blocking/event based streaming XLSX reader
MIT License
57 stars 34 forks source link

Getting wrong .CSV file while converting .XLSX to .CSV #4

Closed Bikasa closed 8 years ago

Bikasa commented 8 years ago

Hi @DaSpawn , For a particular file I am getting wrong data for CSV after converting .xlsx to .csv. May I know the reason ,Why my module takes wrong column data for while converting the xlsx file.I have attached the .xlsx file as well as the out put .csv file in the Zip file. After debugging I have observed that at line no 10 of the excell sheet the 2nd coumn value is coming from the 3rd column value of line no 9 of excel . May I know the reason for this issue.

one.xlsx

one.zip

errorexcel

DaSpawn commented 8 years ago

If I use your xlsx sheet with the example the columns are returned properly as indexed:

RowNum 10 colNum 1 rowValLen 3 rowVal '900' RowNum 10 colNum 2 rowValLen 21 rowVal 'Tiered Royalty Band 3' RowNum 10 colNum 4 rowValLen 6 rowVal '804100' RowNum 10 colNum 5 rowValLen 15 rowVal 'IP Cost Sharing' RowNum 10 colNum 6 rowValLen 0 rowVal '' RowNum 10 colNum 12 rowValLen 3 rowVal 'TPR' RowNum 10 colNum 13 rowValLen 24 rowVal 'MIPCS (not recorded yet)' RowNum 10 colNum 14 rowValLen 9 rowVal 'Principal'

rows are sparse arrays, you need to be sure to use the element index and not just blindly itterate through the rows as any empty cells will not be set in the array (see https://github.com/DaSpawn/xlsx-stream-reader/blob/master/example/example1.js#L31 the colNum variable)