Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

how to set column in excel using parseexcel in perl

by vikram007
on Oct 17, 2012 at 05:10 UTC ( #999455=perlquestion: print w/ replies, xml ) Need Help??
vikram007 has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl use strict; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel::Worksheet; use Parse::RecDescent; #use Spreadsheet::XLSX; use Parse::RecDescent; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; use POSIX qw/strftime/; #use Spreadsheet::WriteExcel; #user arguments: copy, date, machine , arch, my $curr_date = $ARGV[0]; my $cp =1; my $parser = Spreadsheet::ParseExcel::SaveParser->new(); my $readxls = $parser->Parse("perl_$cp.xls"); my $worksheet = $readxls->worksheet('sum-base'); my $worksheet_p = $readxls->worksheet('sum-peak'); my $worksheet_t = $readxls->AddWorksheet($curr_date); $readxls->SaveAs("perl_$cp.xls");
problem:1) how to set column width in excel sheet? 2) how to write in excel sheet 3) how to get percentage of the two cell calculation

Comment on how to set column in excel using parseexcel in perl
Download Code
Re: how to set column in excel using parseexcel in perl
by 2teez (Priest) on Oct 17, 2012 at 05:51 UTC
Re: how to set column in excel using parseexcel in perl
by Corion (Pope) on Oct 17, 2012 at 06:40 UTC

    Have you read the Spreadsheet::WriteExcel documentation? If you look at Spreadsheet::WriteExcel::Examples, you will find the answers for the column width and how to write to an Excel sheet. To calculate a percentage, you will either have to do the calculation in Perl and write the result to an Excel cell, or you will have to write a formula into the Excel sheet.

Re: how to set column in excel using parseexcel in perl
by 2teez (Priest) on Oct 17, 2012 at 06:51 UTC

    Corion++. Really, you said it all. :)

    Hi, vikram007:
    This can give you a kind of push, but really just like Corion said you need get into this Spreadsheet::WriteExcel::Examples

    use warnings; use strict; use Spreadsheet::WriteExcel; my $wk = Spreadsheet::WriteExcel->new('test.xls'); my $ws = $wk->add_worksheet("set column"); # set column width $ws->set_column( 'A:F', 25 ); # write to these columns $ws->write_row( 0, 0, [qw{1 2 3 4 5 6}]); $ws->write( $., 0, [split] ) while (<DATA>); __DATA__ 20 50 12 56 78 90 78 56 23 80 34 67

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
      but i am using "use Spreadsheet::ParseExcel::SaveParser;" module than how i can set a column.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-07-13 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls