开发者

How to write a string starting with '=' to a cell using Spreadsheet::WriteExcel

I'm using the Perl package Spreadsheet::WriteExcel to write an Excel file. I want to write a stri开发者_如何学Gong that starts with the equal sign, "=ABC()", to a cell.

 $ws->write('A1', '=ABC()');

But I got an error message of

 Unknown function ABC() in formula

Can someone advise?


Use the write_string method directly instead of using write:

$ws->write_string('A1', '=ABC()');

Spreadsheet::WriteExcel's write method is a convenience method that guesses what kind of data you're trying to store. If it guesses wrong, you should use one of the type-specific methods.


@Cjm already provided the best answer. Still, I'd like to remember that's possible also to format any cell as text and type whatever you want, that won't be interpreted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜