shenwei356 / csvtk

A cross-platform, efficient and practical CSV/TSV toolkit in Golang
http://bioinf.shenwei.me/csvtk
MIT License
992 stars 84 forks source link

leading zeros are deleted in xlsx2csv command #262

Closed 5003 closed 8 months ago

5003 commented 8 months ago

Hi, When converting with the following versions, leading zeros are deleted.

File: test data Command: csvtk xlsx2csv -n example 000_cell_data.xlsx

Output:

txt
0

Version 0.27.1 does not have this problem.

shenwei356 commented 8 months ago

Thanks for reporting this. It's fixed.

$ csvtk xlsx2csv -n example 000_cell_data.xlsx
txt
000

csvtk_darwin_amd64.tar.gz csvtk_darwin_arm64.tar.gz csvtk_linux_amd64.tar.gz csvtk_windows_amd64.exe.tar.gz

5003 commented 8 months ago

It works. Thank you.

moorereason commented 6 months ago

I believe #262 fixes a related issue I had after upgrading from v0.28.0 to v0.29.0:

csvtk xlsx2csv $foo | csvtk mutate2 -n Debit -w 0 -e '$Total * 100'

would generate an error:

err: Value '$175.00' cannot be used with the modifier '*', it is not a number

The cell in the Excel spreadsheet is a formula of type Currency.

After rebuilding from master (22723a7b46c17b33d8061e2f7820356a32bb175e), the issue is resolved.