简体   繁体   English

如何使用Perl的Spreadsheet :: WriteExcel将Excel文件转换为CSV?

[英]How can I convert an Excel file to CSV with Perl's Spreadsheet::WriteExcel?

I have an Excel sheet and am able to convert it into .csv format using Perl. 我有一个Excel工作表,能够使用Perl将其转换为.csv格式。 My only problem is that some of my data in the Excel sheet cells contain commas and that has to be retained in the CSV format also, but while converting it takes as a seperator. 我唯一的问题是Excel表格单元格中的某些数据包含逗号,并且还必须保留CSV格式,但是在转换时将其作为分隔符。 How can I retreive the data in the cell with commas as it is and print it in the CSV? 如何获取带有逗号的单元格中的数据并直接将其打印为CSV?

For example, in the Excel sheet A1 cell contains the data {0xAAAA,0xFFFF,0xAAAA,0xAAAA} I want the same data with commas in the A1 cell in CSV file also. 例如,在Excel工作表的A1单元格中包含数据{0xAAAA,0xFFFF,0xAAAA,0xAAAA}我也希望CSV文件中A1单元格中的逗号相同。 I am Spreadsheet::ParseExcel . 我是Spreadsheet :: ParseExcel

Use Text::CSV for parsing and creating your csv files. 使用Text :: CSV来解析和创建csv文件。 Be more specific if you do not know how to use the module for your task. 如果您不知道如何在任务中使用该模块,请更加具体。

为避免将字段中的逗号解释为分隔符,请使用双引号等字符将字段括起来:

"10","10,00","156"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM