Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: create xlsx

by poj (Abbot)
on May 31, 2018 at 18:51 UTC ( [id://1215561]=note: print w/replies, xml ) Need Help??


in reply to Re^2: create xlsx
in thread create xlsx

It will take a while to understand your code fully but try this and tell me if it is on the right track

#!/usr/local/bin/perl use strict; use Excel::Writer::XLSX; use Time::Piece; my $date = localtime->strftime('%d%b%Y'); my $filename = "Weekly_Status_${date}.xlsx"; my $book = Excel::Writer::XLSX->new($filename); my $fmt_merge = $book->add_format( border => 1, valign => 'vcenter', align => 'center', ); my $sheet = $book->add_worksheet("PtCorner_Summary_$date"); $sheet->set_row(0,20); $sheet->set_column('A:A',18); $sheet->set_column('B:Z',10); $sheet->write('A1', "PtCorner Wise Summary $date"); $sheet->write_blank('B1'); $sheet->write('A2', "Block"); $sheet->write('B2', "Owner"); $sheet->freeze_panes(3,4); my @ptsliceorder = qw( func_ss_dir1 func_ss_dir2 func_ss_dir3 func_ss_di4 func_ff_dir1 func_ff_dir2 func_ff_dir3 func_ff_dir4 func_ff_dir5 func_ff_dir6 func_ff_dir7 func_ff_dir8 ); my @sliceorder = qw(sr2r hr2r si2r sr2o hi2r hr2o); my $col = 4; my $col0; my $col1; for my $ptOrder (@ptsliceorder) { $col0 = $col; # start col for merge for my $slice (@sliceorder) { $col1 = $col; # start col for merge my @f; if ($slice =~ m/hold/i) { @f = ('wns','ths','hfep'); } else { @f = ('wns','tns','fep'); } for my $value (@f){ $sheet->write(2,$col++, $value); } $sheet->merge_range( 1,$col1,1,$col-1,$slice, $fmt_merge); } $sheet->merge_range( 0,$col0,0,$col-1,$ptOrder, $fmt_merge); } $book->close(); print "$filename created\n";
poj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215561]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found