CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to add headings for all the excel worksheets(Tabs in a excel Work Book) at a time using perl

 



Tejas
Novice

Oct 31, 2013, 8:43 AM

Post #1 of 2 (127 views)
How to add headings for all the excel worksheets(Tabs in a excel Work Book) at a time using perl Can't Post

Hi
I have created an excel book in perl with diffrent worksheets at a time.
Now i have same headings for all the sheets ,and would like to write all of them at a time , i tried below code but it doesnt work at all.
I think iam making a mistake in for each loop, i tried options but could be successful.
I l lbe glad if helpd.

use Spreadsheet::WriteExcel;
my $pwd = `pwd`;
chomp ($pwd);

my $full_path = "$pwd/Test.csv";
#Input RCSL file

my $workbook = Spreadsheet::WriteExcel->new($full_path);

#Add Tabs to the worksheet

my $Duplicate_Sale = $workbook->add_worksheet("Duplicate_Sale");
my $Payment_For_Sale_Missing = $workbook->add_worksheet("Payment_For_Sale_Missing");
my $Payment_For_Refund_Missing = $workbook->add_worksheet("Payment_For_Refund_Missing");
my $Refund_Missing = $workbook->add_worksheet("Refund_Missing");
my $Sale_Missing = $workbook->add_worksheet("Sale_Missing");
my $Sale_Vs_Payment_Mismatch = $workbook->add_worksheet("Sale_Vs_Payment_Mismatch");
my $Payment_For_Refund_DblBooking= $workbook->add_worksheet("Payment_For_Refund_DblBooking");
my $REPORT = $workbook->add_worksheet("REPORT");
my $Unknown_Bucket = $workbook->add_worksheet("Unknown_Bucket");

#Add Header Columns to Each Worksheet
foreach my $worksheet (@{$workbook->{worksheets}}) {
#foreach my $worksheet ($workbook->worksheets()) {
print "$worksheet \n";
$worksheet->write(0, 0, "Customer_Id");
$worksheet->write(0, 1, "Entry_Source_Id");
$worksheet->write(0, 2, "Amount");
$worksheet->write(0, 3, "Min_Date");
$worksheet->write(0, 4, "Max_Date");
$worksheet->write(0, 5, "Min_Etid");
$worksheet->write(0, 6, "Max_Etid");
$worksheet->write(0, 7, "Avg_Etid");
$worksheet->write(0, 8, "PPCL_ID");
$worksheet->write(0, 9, "Count");
$worksheet->write(0, 10, "Month");
$worksheet->write(0, 11, "Year");
}


Thnks
Tejas


(This post was edited by Tejas on Oct 31, 2013, 8:44 AM)


Tejas
Novice

Oct 31, 2013, 8:55 AM

Post #2 of 2 (124 views)
Re: [Tejas] How to add headings for all the excel worksheets(Tabs in a excel Work Book) at a time using perl [In reply to] Can't Post

 foreach my $worksheet ($workbook->sheets()) {


This for each loop workerd for me .
Will keep this thread posted abt my further work
Thnks
Tejas:)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives