#! /usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = new Spreadsheet::WriteExcel('hallo.xls'); die "Problems creating new Excel file: $!" unless defined $workbook; my $sheet = $workbook -> add_worksheet(); my $cell = 0; for( 100, 10, 5 ){ my $format= $workbook -> add_format(); my $color = 'green'; if( $_ < 10 ){ $color = 'red'; } elsif( $_ > 10 ){ $color = 'blue'; } $format->set_bg_color( $color ); $sheet -> write(0, $cell++, $_, $format); } $workbook -> close() or die "Error closing file: $!";