467,081 Members | 1,183 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,081 developers. It's quick & easy.

Create Excel file from csv file.

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
  • viewed: 5327
Share:
7 Replies
Icecrack
Expert 100+
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 256MB
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+
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 256MB
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
Thanks for your replies.
Can I create different sheets with out using Spreadsheet::WriteExcel or Win32::OLE?
Sep 29 '08 #6
KevinADC
Expert 2GB
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
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.

Similar topics

6 posts views Thread by Steve Richter | last post: by
27 posts views Thread by jeniffer | last post: by
reply views Thread by kennedystephen | last post: by
reply views Thread by kennedystephen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.