By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,176 Members | 984 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,176 IT Pros & Developers. It's quick & easy.

Create Excel file from csv file.

P: 7
I want to create an excel file (Microsoft Excel) with tabs using perl. I need to run my perl script in the Unix environment. I can do it with Spreadsheet::WriteExcel.
Can I create the excel file without using Spreadsheet::WriteExcel?
Sep 29 '08 #1
Share this Question
Share on Google+
7 Replies


Icecrack
Expert 100+
P: 174
There may be another module but not in the default perl builds,
such as:

Expand|Select|Wrap|Line Numbers
  1. open (FH, >> "test.xls");
this is because the binary format.

so you must use some sort of Spreadsheet::WriteExcel or other unless you learn how to create your own.


note: this is what i know, there may be some other solution.
Sep 29 '08 #2

nithinpes
Expert 100+
P: 410
You can create an excel sheet without need of Spreadsheet::WriteExcel or Win32::OLE. But handling data in the file and multiple sheets would require the use of these modules.
You can create an excel file as you create any other file in perl, but with a .xls extension. While printing/writing to file, \t will move to next cell in the row and \n will move to next row.

Expand|Select|Wrap|Line Numbers
  1. use strict; 
  2. open(EX,">template.xls") or die "$!";
  3. print EX "one\t two \t three\n"; # first row
  4. print EX "1\t 2 \t 3\n"; #second row
  5. close EX;
  6.  
Sep 29 '08 #3

Icecrack
Expert 100+
P: 174
You can create an excel sheet without need of Spreadsheet::WriteExcel or Win32::OLE. But handling data in the file and multiple sheets would require the use of these modules.
You can create an excel file as you create any other file in perl, but with a .xls extension. While printing/writing to file, \t will move to next cell in the row and \n will move to next row.

Expand|Select|Wrap|Line Numbers
  1. use strict; 
  2. open(EX,">template.xls") or die "$!";
  3. print EX "one\t two \t three\n"; # first row
  4. print EX "1\t 2 \t 3\n"; #second row
  5. close EX;
  6.  

I want to create an excel file (Microsoft Excel) with tabs using perl.
i was thinking that but sheets will be a problem.
Sep 29 '08 #4

nithinpes
Expert 100+
P: 410
i was thinking that but sheets will be a problem.
Yes. Also, handling objects like table, pivot charts etc. will be a problem. But for the simple objective of writing to an excel sheet, the approach can be used.

You can create an excel sheet without need of Spreadsheet::WriteExcel or Win32::OLE. But handling data in the file and multiple sheets would require the use of these modules.
Sep 29 '08 #5

P: 7
Thanks for your replies.
Can I create different sheets with out using Spreadsheet::WriteExcel or Win32::OLE?
Sep 29 '08 #6

KevinADC
Expert 2.5K+
P: 4,059
Thanks for your replies.
Can I create different sheets with out using Spreadsheet::WriteExcel or Win32::OLE?
You probably can if you are familiar with how excel does all those things internally. Why don't you look at the source code of the modules to try and figure out how its done if you don't want to actually use the modules for some reason.
Sep 29 '08 #7

P: 7
Hey thanks for your suggestion. I will look into the source code of the module.
Oct 1 '08 #8

Post your reply

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