2015-04-07 68 views
0

我正在使用Spreadsheet::WriteExcel將數據寫入excel。
我已經使用了每行write_row()。
當我嘗試寫有一行數據(=),它拋出一個錯誤說:無法解析公式:=,因爲Excel中認爲這是公式。
我需要使用數組作爲一行寫數據,所以有沒有辦法做到這一點?

下面的代碼片段:
使用Spreadsheet寫入write_row時發生錯誤:: WriteExcel

use Spreadsheet::WriteExcel; 
my $workbook = Spreadsheet::WriteExcel->new("../tmp/op.xls"); 
my $worksheet = $workbook->add_worksheet(); 
my @data = ('1','1','=',"testdata"); 
$worksheet->write_row("A1", \@data);   
$workbook->close(); 

輸出:

Couldn't parse formula: = at 

回答

1

Spreadsheet::WriteExcel模塊文件的DIAGNOSTICS部分,它指出:

未能進行解析公式...

There are a large number of warnings which relate to badly formed formulas and functions. See the "FORMULAS AND FUNCTIONS IN EXCEL" section for suggestions on how to avoid these errors. You should also check the formula in Excel to ensure that it is valid.

+0

感謝您的答覆,但我想要的東西與write_row()函數的作品,並避免公式錯誤。 – Ganesh

1

如果你只是想在該單元格等號,你可以用一點點領先的空白,這將捅了「=」到該行沒有公式錯誤住:

my @data = ('1','1', ' = ', "testdata"); 

作品中LibreOffice Calc也是如此。

我很好奇你打算如何在SS中使用=運算符?你可以用一個運算符取消引用一個單元格來建立一個動態的Excel公式嗎?我不是一個Excel專家:-)

相關問題