- 论坛徽章:
- 0
|
本帖最后由 yaohuabing 于 2015-06-06 08:06 编辑
perl处理excel最常用的module是
Spreadsheet::WriteExcel (生成新的excel) 和
Spreadsheet::ParseExcel(读excel)
在WriteExcel的文档里关于修改已有的excel,有这么一段:
MODIFYING AND REWRITING EXCEL FILES
An Excel file is a binary file within a binary file. It contains several interlinked checksums and changing even one byte can cause it to become corrupted.
As such you cannot simply append or update an Excel file. The only way to achieve this is to read the entire file into memory, make the required changes or additions and then write the file out again.
You can read and rewrite an Excel file using the Spreadsheet::ParseExcel::SaveParser module which is a wrapper around Spreadsheet::ParseExcel and Spreadsheet::WriteExcel. It is part of the Spreadsheet::ParseExcel package: search.cpan.org/search?dist=Spreadsheet-ParseExcel.
However, you can only rewrite the features that Spreadsheet::WriteExcel supports so macros, graphs and some other features in the original Excel file will be lost. Also, formulas aren't rewritten, only the result of a formula is written.
按照你的需求,最好的办法就是读这两个excel文件,匹配内容,然后生成新的excel文件 |
|