- 論壇徽章:
- 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文件,匹配內(nèi)容,然后生成新的excel文件 |
|