Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Spreadsheet::WriteExcel -> Conditional Formatting Colors

by sectokia (Pilgrim)
on Jul 05, 2021 at 03:57 UTC ( [id://11134646]=perlquestion: print w/replies, xml ) Need Help??

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

In the doc for 'Spreadsheet::WriteExcel' there this example for conditional color based on positive or negative percent value:

$f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');

I would like to do something slightly different: Green if over 80%, orange if over 40%, otherwise red. However I cannot understand the syntax of the format string

Everything I have tried results in excel complaining about the format and asking to recover the document :-(

Any ideas? Thanks!

Replies are listed 'Best First'.
Re: Spreadsheet::WriteExcel -> Conditional Formatting Colors
by swl (Parson) on Jul 05, 2021 at 06:41 UTC

    XLSX files are just zipped XML files (plus some other components). You could try setting up a simple worksheet with your desired formatting, and then extract the file contents (I use 7zip on Windows) and view them using a text editor to see what is expected.

    Look under the xl/worksheets subdir to find the actual data.

    Edit - although that is for setting the rules directly in the file. Maybe there is a more effective approach using Spreadsheet::Excel.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11134646]
Approved by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 05:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found