hebes_99 has asked for the wisdom of the Perl Monks concerning the following question:

Masters of Wisdom: I am working on a program that writes data to an EXCEL workbook. I have everything working, with the exception of formatting the cell. Occasionally, I need to write in something like 2-89. I DO NOT want this read as a date, but rather just as it is. When I open the workbook, EXCEL automatically changes it to Feb-89. I am not sure how to format the cell as a text cell through PERL. Suggestions???

Replies are listed 'Best First'.
Re: EXCEL question
by chargrill (Parson) on Feb 15, 2006 at 20:28 UTC

    It's hard to tell what you're doing from the code you've posted, but I know that if I'm using excel the old fashioned way (manually) and want numbers entered as is, I put a single quote in front of them.



    --chargrill
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
Re: EXCEL question
by ww (Archbishop) on Feb 15, 2006 at 20:32 UTC
Re: EXCEL question
by monarch (Priest) on Feb 16, 2006 at 00:00 UTC
    Spreadsheet::WriteExcel is a very powerful module. I have used it in the past to submit thousands of circuit change requests from one Telco to another when they insisted they wanted the requests in that format.

    You can set the formatting of a cell using this module. Besides setting the cell value, you can set the cell format. Have a good read over the module documentation because it is very useful if you have particular formatting requirements (including colouring, cell width, and borders!).

Re: EXCEL question
by VSarkiss (Monsignor) on Feb 15, 2006 at 22:52 UTC
Re: EXCEL question
by Anonymous Monk on Feb 15, 2006 at 22:39 UTC
    Precede your string with a single quote. Write '2-89 to the cell instead of 2-89.