首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >xls2csv +禁用XLS中的空空间

xls2csv +禁用XLS中的空空间
EN

Stack Overflow用户
提问于 2014-07-28 16:44:47
回答 1查看 602关注 0票数 0

我使用xls2csv二进制文件将XLS转换为linux红帽子机器中的CSV,

在某些情况下,XLS文档在word之前或word之后都有空格。

XLS文件示例( word3在右侧有一个空格)

代码语言:javascript
复制
 word1 word2 "word3 "
 word1 word2 "word3 "
 word1 word2 "word3 "

运行xls2csv之后

作为:

代码语言:javascript
复制
  xls2csv -x "1252spreadsheet.xls" -b WINDOWS-1252 -c "ut8csvfile.csv" -a UTF-8 ) 

我注意到csv中的word3在word3上有与XLS ( "word3“)相同的空间。

请建议如何配置xls2csv二进制文件,以便禁用空空间?从XLS文档,所以我将得到CSV没有空空间?

从XLS2CSV手册页面:

代码语言:javascript
复制
 man xls2csv
 XLS2CSV(1)            User Contributed Perl Documentation           XLS2CSV(1)

 NAME
       xls2csv - A script that recodes a spreadsheetâs charset and saves as CSV.

    DESCRIPTION
        This script will recode a spreadsheet into a different character set and output     the recoded data as a csv file.

          The script came about after many headaches from dealing with Excel   spreadsheets from clients that were being
       received in various character sets.

  OPTIONS
           -x     : filename of the source spreadsheet
           -b     : the character set the source spreadsheet is in (before)
           -c     : the filename to save the generated csv file as
           -a     : the character set the csv file should be converted to (after)
           -q     : quiet mode
           -s     : print a list of supported character sets
           -h     : print help message
           -v     : get version information
           -W     : list worksheets in the spreadsheet specified by -x
           -w     : specify the worksheet name to convert (defaults to the first worksheet)
           -n     : specify the worksheet number to convert (you cannot use this option with -w)
           -f     : force the worsheet to be fully parsed. This disables the feature that skips rows when the first cell is blk
EN

回答 1

Stack Overflow用户

发布于 2014-07-28 17:24:00

听起来你用错工具了。也许您应该编写一个使用电子表格::ParseExcel来读取/解析xls文件的脚本,然后应用所需的任何字段重新格式化。完成之后,使用Text::CSV_XS输出csv数据。

编辑:我想把它作为一个评论来发布,但我想它也可以作为一个答案。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25000101

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档