Vidur Oberoi
Vidur Oberoi

Reputation: 75

Converting csv to xls using Data::Table::Excel?

How do you use Data::Table::Excel for converting .csv to .xls file format.

I want to do the conversion with the tables2xls subroutine:

my $t = Data::Table::fromFile("testresults-2013-07-01.csv");  
my @arr = $t->csv;  
Data::Table::Excel::tables2xls("results.xls", $t ,\@arr);

I tried the code above but I was not able get what I expected.

Upvotes: 1

Views: 1661

Answers (1)

gangabass
gangabass

Reputation: 10666

Last line must be:

Data::Table::Excel::tables2xls("results.xls", [$t] ,["Sheet name for your Table"]);

And here is colors example like you want:

Data::Table::Excel::tables2xls("results.xls", [$t] ,["Sheet name for your Table"], [["white","silver","gray"]]);

Upvotes: 2

Related Questions