473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Excel sheet creation using perl

I want to create excel sheet using perl, i had installed all the necessary modules from CPAN.

The perl program i taken from CPAN itself it is given below,
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use warnings;
  3. use strict;
  4. use Excel::Template;
  5. # Create the Excel template
  6. my $template = Excel::Template->new(
  7.     filename => 'test.xml',
  8. );
  9. # Add a few parameters
  10. $template->param(
  11.     HOME => $ENV{HOME},
  12.     PATH => $ENV{PATH},
  13. );
  14. $template->write_file('test.xls');
  15.  
and test.xml is
Expand|Select|Wrap|Line Numbers
  1. <workbook>
  2. <worksheet name="tester">
  3. <cell text="$HOME" />
  4. <cell text="$PATH" />
  5. </worksheet>
  6. </workbook>
  7.  
test.xls file is getting created but when i tries to open it i am getting following error,
Error loading document file filename
Incorrect file format

So help me for overcoming on this problem.
Mar 1 '07 #1
3 3986
miller
1,089 Expert 1GB
I do not know why Excel::Template is not working for you as I have no experience with it. I suggest that you use Spreadsheet::WriteExcel instead, as it more commonly used and has a lot more features:

cpan Spreadsheet::WriteExcel

- M
Mar 1 '07 #2
Thanks for your help,
according to your suggestion i used
Spreadsheet::WriteExcel for excel sheet generation and now i am able to
create excel sheet using perl.
Thanks once again....
Mar 2 '07 #3
miller
1,089 Expert 1GB
Thanks for your help,
according to your suggestion i used
Spreadsheet::WriteExcel for excel sheet generation and now i am able to
create excel sheet using perl.
Thanks once again....
Excellent. Glad I could help.

- Miller
Mar 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: acharyaks | last post by:
Hi life saver, I am using excel component for the development. The purpose is to connect to excel through the odbc connection string. Then through the connection extract data into a dataset and...
3
by: rlntemp-gng | last post by:
RE: Access 2003/Excel 2003 Problem: After I close the Access application completely, I go out to the Task Manager and there is an Excel.exe object still sitting out there. My Access...
0
by: rajeshkothuru | last post by:
Hi I am new to perl programming, i stcked at one line. I have written code such that new excel sheet will save accordingly even though if already existed Excel sheet persists. The problem is if...
5
by: Sport Girl | last post by:
Hi everybody. I am new in PERL language and working in it since little hours, actually i am still a trainee and i need help please. In fact, i need a script in PERL that enables me to retrieve...
1
by: pvenu | last post by:
Hi, I know basic perl (regular expressions, pattern matching, string manipulation, reading writing into text files). Yet, my requirement is to read an input text file -> process this input file...
6
by: poolboi | last post by:
hi all, i've got the following program that needs yr help: use Win32::OLE; # use existing instance if Excel is already running eval {$ex =...
18
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location:...
6
by: Gilbert Tordeur | last post by:
Hello ! My web application generates an Excel sheet on the server. Then I would like to generate a pdf file from this Excel sheet. How can I do ? Thank you for your help, Gilbert
2
by: ravir81 | last post by:
Hi, I am working on excel reporting using Perl. I am facing problem with writing the header part only once for all the excels created using Perl. Here is the code : ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.