Converting comma separated files to multi-sheel spreadsheets (Gnumeric of OOMATH)

  • Follow


I'm generating a report file as multiple comma separated files, .csv. The 
amount of data is too large to be read as a single spreadsheet, it's much 
more convenient for the user if it's presented as multiple sheets.

Both Gnumeric and OOMATH can read .csv files but unfortunately if you 
hand them multiple files they open multiple windows which is really 
messy. The .csv format doesn't have any means of defining sheets and .xls 
and .ods are binary formats that are to difficult to generate. Is there a 
simple way to generate a multisheet spreadsheet, such as a switch to 
Gnumeric or OOMATH, that will take multiple .csv files and convert them 
in to a single multi-sheet spreadsheet?
 
0
Reply schvantzkopf (287) 8/6/2008 6:11:08 PM

General Schvantzkopf staggered into the Black Sun and said:
> Both Gnumeric and OOMATH can read .csv files but unfortunately if you
> hand them multiple files they open multiple windows which is really
> messy. The .csv format doesn't have any means of defining sheets and
> .xls and .ods are binary formats that are to difficult to generate.

"Difficult"?

#!/usr/bin/perl -w
use Spreadsheet::WriteExcel;

my $workbook = Spreadsheet::WriteExcel->new("temp.xls");
$sheet1 = $workbook->add_worksheet("sheet1");
$sheet2 = $workbook->add_worksheet("sheet2");

$sheet1->write(0,0,"Row 0 column 0");
$sheet2->write(1,2,"Row 1 column 2 sheet 2");

# continue; specifics depend on what it is you need to do here, possibly
# using Text::CSV_XS to read in the CSV file....

....this module has been around a long time; I remember using it in 2001.
I don't know precisely what you want, but it's definitely possible to
take CSV data, parse it with a Perl script, and output some sort of
meaningful Excel file.

-- 
    No man is an island, but then no man is a potato salad, either.
  My blog: http://crow202.org/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
0
Reply danceswithcrows (534) 8/9/2008 6:48:12 PM


On Sat, 09 Aug 2008 18:48:12 +0000, Dances With Crows wrote:

> General Schvantzkopf staggered into the Black Sun and said:
>> Both Gnumeric and OOMATH can read .csv files but unfortunately if you
>> hand them multiple files they open multiple windows which is really
>> messy. The .csv format doesn't have any means of defining sheets and
>> .xls and .ods are binary formats that are to difficult to generate.
> 
> "Difficult"?
> 
> #!/usr/bin/perl -w
> use Spreadsheet::WriteExcel;
> 
> my $workbook = Spreadsheet::WriteExcel->new("temp.xls"); $sheet1 =
> $workbook->add_worksheet("sheet1"); $sheet2 =
> $workbook->add_worksheet("sheet2");
> 
> $sheet1->write(0,0,"Row 0 column 0"); $sheet2->write(1,2,"Row 1 column 2
> sheet 2");
> 
> # continue; specifics depend on what it is you need to do here, possibly
> # using Text::CSV_XS to read in the CSV file....
> 
> ...this module has been around a long time; I remember using it in 2001.
> I don't know precisely what you want, but it's definitely possible to
> take CSV data, parse it with a Perl script, and output some sort of
> meaningful Excel file.

Do you know if there is a C library that supports .xls?

0
Reply schvantzkopf (287) 8/9/2008 7:06:53 PM

On 2008-08-09, General Schvantzkopf <schvantzkopf@yahoo.com> wrote:
> On Sat, 09 Aug 2008 18:48:12 +0000, Dances With Crows wrote:
>
>> General Schvantzkopf staggered into the Black Sun and said:
>>> Both Gnumeric and OOMATH can read .csv files but unfortunately if you
>>> hand them multiple files they open multiple windows which is really
>>> messy. The .csv format doesn't have any means of defining sheets and
>>> .xls and .ods are binary formats that are to difficult to generate.
>> 
>> "Difficult"?
>> 
>> #!/usr/bin/perl -w
>> use Spreadsheet::WriteExcel;
>> 
>> my $workbook = Spreadsheet::WriteExcel->new("temp.xls"); $sheet1 =
>> $workbook->add_worksheet("sheet1"); $sheet2 =
>> $workbook->add_worksheet("sheet2");
>> 
>> $sheet1->write(0,0,"Row 0 column 0"); $sheet2->write(1,2,"Row 1 column 2
>> sheet 2");
>> 
>> # continue; specifics depend on what it is you need to do here, possibly
>> # using Text::CSV_XS to read in the CSV file....
>> 
>> ...this module has been around a long time; I remember using it in 2001.
>> I don't know precisely what you want, but it's definitely possible to
>> take CSV data, parse it with a Perl script, and output some sort of
>> meaningful Excel file.
>
> Do you know if there is a C library that supports .xls?

Searching at sourceforge.net returns 78 hits.  I suspect one
or two of those hits might be close to what you're looking
for.

-- 
Robert Riches
spamtrap42@verizon.net
(Yes, that is one of my email addresses.)
0
Reply spamtrap42 (1175) 8/9/2008 9:41:36 PM

3 Replies
56 Views

(page loaded in 0.082 seconds)


Reply: