shenwei356 / csvtk

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

Add a option to csv2xlsx for output number as Text or number #217

Closed zuisong closed 1 year ago

zuisong commented 1 year ago

Prerequisites

Describe your issue

Thank you

$ echo 8911111111111111111111111173 | csvtk  -H csv2xlsx -o /tmp/tempfile  &&  csvtk xlsx2csv   /tmp/tempfile
8911111111111111000000000000

output has lost some text.

Maybe we can add a option to csv2xlsx control output number as Text or number. It seems like

$ echo 8911111111111111111111111173 | csvtk  -H csv2xlsx --number-as-text -o /tmp/tempfile  &&  csvtk xlsx2csv   /tmp/tempfile
8911111111111111111111111173
zuisong commented 1 year ago

Link issue: https://github.com/shenwei356/csvtk/issues/192

shenwei356 commented 1 year ago

oh, right, it should be optional.

shenwei356 commented 1 year ago

Added a flag.

  -f, --format-numbers   save numbers in number format, instead of text

csvtk_linux_amd64.tar.gz