Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

Perl script help

cemokam
Occasional Contributor

Perl script help

Hello Forum,

I have some text files and I want to export them into 1 excel file.Let's say text files are like  

a.txt

b.txt

c.txt

d.txt

What I want to get these text files into an excel file called as "final.xls" and When I open it I want to see the sheets as

a.txt--->sheet1

b.txt--->sheet2

c.txt---->sheet3

d.txt---->sheet4

 

is it possible?

 

PS:I have downloaded and installed Spreadsheet-WriteExcel-2.37 over my unix perl env.

 

 

 

1 REPLY
Highlighted
Matti_Kurkela
Honored Contributor

Re: Perl script help

Yes, it is possible.

 

See the documentation of the Spreadsheet::WriteExcel perl module:

http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.37/lib/Spreadsheet/WriteExcel.pm

 

The Quick Start lists 3 steps required when creating an Excel file:

  1. create a "workbook" (= the Excel file) using the new() method
  2. create a worksheet in the workbook using the add_worksheet() method
  3. write() to the worksheet. (write_row() or write_col() might be useful too).

When you want to create another worksheet, simply perform the step 2 again using the original workbook object. It will give you a new worksheet object, referring to the next worksheet.

MK