in reply to set color base on cell's value in your Excel
Welcome to the monastery, gbcbooks!
What you are trying to do is called conditional formatting. You want to format the cells in a certain way (set background colour), when a certain condition is met.
Unfortunately, the module you are using has very limited support for conditional formatting. Basically, you can only set the color tags for negative and positive values, like this:
my $f_change = $workbook->add_format(); $f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%'); $worksheet->write(2, 3, -0.015, $f_change); # negative, will be printe +d in red
If you want conditional formatting, I can only suggest that you switch to Excel::Writer::XLSX. It does exactly what you want, has excellent documentation, and a lot of examples, including an example for conditional formatting.
Good luck!
- Luke
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: set color base on cell's value in your Excel
by gbcbooks (Initiate) on Nov 13, 2015 at 05:56 UTC | |
by blindluke (Hermit) on Nov 13, 2015 at 09:24 UTC |