Thanks very much jbmraja
Maybe I didn't make it clear. I need to create a new worksheet on a existing excel file; and change worksheet name, not name of excel file. for example, Sheet2 -> router3
How to use Perl script to create a new worksheet and rename worksheet name on a existing Excel file?
Thanks very much in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This is difficult then... there are two modules you can use - 1 will read an excel file, and 1 will write an excel file - but there aren't any (that I know of) that can change an existing file.
So if you have to do it this way, you would need to read the file, and write a new file, copying the info from the original, but with the changes you need. In writing the new file, not all the features are supported, so you may lose some of the info from the original.
If you have a windows computer running excel, it might work better to develop an excel script to do what you need.
The documentation and the actual modules are on CPAN:
To parse an excel file:
http://search.cpan.org/~jm
To write an excel file:
http://search.cpan.org/~jm
To install the modules, as long as your computer has internet access, you can use the cpan module/program. Do do so, as root, run:
cpan Spreadsheet::ParseExcel
cpan Spreadsheet::WriteExcel
If you can't be root, you can install the modules to your personal directory, and include that in the perl @INC search path, using either the PERL5LIB environment variable, or a use lib statement in your program.
D:\IS>cpan Spreadsheet::ParseExcel
Goi
Database was generated on Tue, 07 Apr 2009 08:28:03 GMT
Running install for module 'Spreadsheet::ParseExcel'
R
Checksu
el-0.49.t
Spreadsheet-ParseExcel-0
Spread
Spreadshee
Sprea
Spr
S
Spreads
Sp
Spreadshee
Spreadsh
Spreadshee
Spre
Spreads
Spreadshe
Spreads
Spr
Spreads
Spreadshee
Sp
Spre
Spreadshe
Spr
Spread
Spreadshe
Spreadshee
Spre
Spreadsh
Spre
Spreadshee
Sprea
S
Spread
Spr
Sprea
S
Spread
Sp
Spreadsh
Spre
Spr
S
Spreads
Spreads
Sprea
Spread
Spreadsh
Spreadshe
Spread
Spreadshee
Spreadshe
Spreads
Spread
Spre
Spreadshee
Sprea
Spr
Spreadshee
Spreadshe
Spreads
Spreadsh
Sprea
Spr
Spreadshee
Sprea
Spreadshe
Sprea
Spreadshe
Sp
Spreads
Sp
Spr
Spreadsh
Spreadsh
Spreadsh
Spreadsh
Sp
Spre
Spreadsh
Sprea
Spreadsh
CPAN.pm: Going to build J/JM/JMCNAMARA/Spreadsheet
$Config
Checking if your kit is complete...
Looks good
Warning: prerequisite IO::Scalar 0 not found.
Warning: prerequisite OLE::Storage_Lite 0.08 not found.
Writing Makefile for Spreadsheet::ParseExcel
---
---- JMCNAMARA/Spreadsheet-Pars
IO::Scalar [requires]
OLE::Storage_Lite [requires]
Running make test
Delayed until after prerequisites
Running make install
Delayed until after prerequisites
Running install for module 'IO::Scalar'
Running make for D/DS/DSKOLL/IO-stringy-2.1
C
ok
IO-stringy-2.110/
IO-stri
I
IO-stri
IO-str
IO
IO-strin
I
IO-strin
IO-s
IO
IO-s
IO-
IO-stri
IO-strin
IO-s
IO-string
IO
IO-s
IO-strin
IO-stringy
IO-stringy
I
IO-stringy
IO-str
I
IO-stri
IO
IO-stri
IO-s
CPAN.pm: Going to build D/DS/DSKOLL/IO-stringy-2.1
C
Looks good
Writing Makefile for IO::Stringy
'nmake' is not recognized as an internal or external command,
operable program or batch file.
DSKOLL/IO-stringy-2.110.ta
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Running install for module 'OLE::Storage_Lite'
Running
Che
8.tar.gz ok
OLE-Storage_Lite-0.18/
OL
OLE
OLE-Sto
OLE-Sto
OL
OLE-Stora
OLE-Stora
OLE-Stora
O
OL
OLE-Sto
OLE-Stora
OLE-Stora
OLE-Storag
OL
OL
OLE-S
OLE-Stor
OLE-
O
CPAN.pm: Going to build J/JM/JMCNAMARA/OLE-Storage
Che
Looks good
Writing Makefile for OLE::Storage_Lite
'nmake' is not recognized as an internal or external command,
operable program or batch file.
JMCNAMARA/OLE-Storage_Lite
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Running make for J/JM/JMCNAMARA/Spreadsheet
Has already been unwrapped into directory C:\Perl\cpan\build\Spreads
Excel-0.49
CPAN.pm: Going to build J/JM/JMCNAMARA/Spreadsheet
Warning
el-0.49.ta
h 'make => NO'. Continuing, but chances to succeed are limited.
Warning: Prerequisite 'OLE::Storage_Lite => 0.08' for 'J/JM/JMCNAMARA/Spreadshee
t-ParseExc
e-0.1
.
'nmake' is not recognized as an internal or external command,
operable program or batch file.
JMCNAMARA/Spreadsheet-Pars
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
D:\IS>
D:\IS>cpan Spreadsheet::WriteExcel
Goi
Database was generated on Tue, 07 Apr 2009 08:28:03 GMT
Running install for module 'Spreadsheet::WriteExcel'
R
Checksu
el-2.25.t
Spreadsheet-WriteExcel-2
Spread
Spre
Sprea
Spreadshee
Sprea
Spreadshee
Sprea
Spreadshee
Sprea
Spreadshee
Sprea
Spreadshee
Sprea
Sp
Spreadshe
Spread
Spr
Spreadshee
Spreadshe
Spreads
Sp
Spreadshee
Spread
Spre
Sp
Spreadshee
Spreadsh
Spre
S
Spreads
Sprea
Spre
Sp
Spreadsh
Spreadsh
Spreads
Spread
Sprea
Spre
Spr
Spreadshe
Sp
Sprea
Sprea
Spreadsh
Spreadshee
Spr
Spr
Spreadshee
Sprea
Spreadshe
Spreadshee
S
Sp
Sp
Sprea
Sp
Spr
Spre
Sprea
S
Spreadshee
Spreadshee
Spreadshee
Spr
Spreadshe
Spre
Spreads
Spreads
Spreads
Spreads
S
Sprea
Spreadshee
Spre
Spreadsh
Sp
Spread
Spreadshee
Spre
Sprea
Spread
Spreadshe
Sp
Spreads
Spreads
Spreads
Spre
Spreads
S
Sp
Spreadshe
S
Spread
Spreadsh
Spr
Spre
Spreadsh
S
S
Spr
Spreadsh
Sp
Spreads
S
Spreads
Sp
Spreadshee
Spreads
Spr
Spreadsh
Spre
Spreadshe
Spr
Spreadshee
Spread
Spre
Sprea
Sprea
Spreadsh
Spreadshee
Spreads
Spreadsh
Spreadshee
Spr
S
Spreads
Spr
Spreadshe
Sprea
Spreadshee
Sprea
Spr
Spreadshe
Spre
Spread
Sprea
Sp
Spreadsh
Spr
Spread
Spreadsh
Spr
Spreads
Spreadsh
S
Spre
Sprea
Spreadshe
Spr
Spreadshe
Spreadshe
Spr
Sprea
Spreads
Sprea
Spreadshee
S
Spreadshee
Sp
Spreadsh
Spre
Spreads
Spread
Spre
Sprea
Spreads
Sp
Spreads
Sp
Spread
Spread
Spreadshee
Spre
Spread
Spreads
Sp
CPAN.pm: Going to build J/JM/JMCNAMARA/Spreadsheet
Checkin
Looks good
Warning: prerequisite OLE::Storage_Lite 0.14 not found.
Warning: prerequisite Parse::RecDescent 0 not found.
Writing Makefile for Spreadsheet::WriteExcel
---
---- JMCNAMARA/Spreadsheet-Writ
OLE::Storage_Lite [requires]
Parse::RecDescent [requires]
Running make test
Delayed until after prerequisites
Running make install
Delayed until after prerequisites
Running install for module 'OLE::Storage_Lite'
Running
Che
8.tar.gz ok
OLE-Storage_Lite-0.18/
OL
OLE
OLE-Sto
OLE-Sto
OL
OLE-Stora
OLE-Stora
OLE-Stora
O
OL
OLE-Sto
OLE-Stora
OLE-Stora
OLE-Storag
OL
OL
OLE-S
OLE-Stor
OLE-
O
CPAN.pm: Going to build J/JM/JMCNAMARA/OLE-Storage
Che
Looks good
Writing Makefile for OLE::Storage_Lite
'nmake' is not recognized as an internal or external command,
operable program or batch file.
JMCNAMARA/OLE-Storage_Lite
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Running install for module 'Parse::RecDescent'
Running
Check
tar.gz ok
Parse-RecDescent-1.94/
Pa
Par
Parse-
Parse-Rec
P
Parse-R
Parse-Re
Parse
Parse-R
Par
Parse-RecD
Parse-Rec
Parse-R
Parse-
Par
Parse-RecD
Parse-
Parse
Parse
Pa
Pa
Parse-Re
Parse-Re
Parse-
Parse-Re
Pa
Parse-Rec
Parse
P
Parse-Rec
Parse-RecD
Parse-Rec
Parse-Re
Pars
Parse-RecD
Parse-Re
Par
Pa
Parse-
Pa
Parse-Rec
Parse-R
Parse-
Parse-RecD
Parse-Re
Par
Parse-R
Pars
Pars
Parse-
Parse-R
Parse-
Parse-Rec
P
Parse-Re
Parse
CPAN.pm: Going to build D/DC/DCONWAY/Parse-RecDesc
Check
Looks good
Writing Makefile for Parse::RecDescent
'nmake' is not recognized as an internal or external command,
operable program or batch file.
DCONWAY/Parse-RecDescent-1
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Running make for J/JM/JMCNAMARA/Spreadsheet
Has already been unwrapped into directory C:\Perl\cpan\build\Spreads
Excel-2.25
CPAN.pm: Going to build J/JM/JMCNAMARA/Spreadsheet
Warning
t-WriteExc
e-0.1
.
Warning: Prerequisite 'Parse::RecDescent => 0' for 'J/JM/JMCNAMARA/Spreadshee
riteExc
4.
'nmake' is not recognized as an internal or external command,
operable program or batch file.
JMCNAMARA/Spreadsheet-Writ
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
D:\IS>
My Perl version is ActivePerl-5.10.0.1004-MSW
In order to deal with Excel files, I want to reinstall Perl. Adam314, would you please tell me the best way to install Perl?
I really appreciate your help!
Business Accounts
Answer for Membership
by: jbmrajaPosted on 2009-04-01 at 00:13:15ID: 24036595
You can create excel file by using the perl module Spreadsheet::WriteExcel. cnamara/Sp readsheet- WriteExcel - 2.25/lib/ Spreadshee t/WriteExc el.pm
Follow this link:
http://search.cpan.org/~jm
You can rename an existing excel file by using thae basic perl command rename
Syntax:
rename(OLDNAME,NEWNAME)
It changes the name of a file. Returns 1 for success, 0 otherwise.
Hope this may help you..