473,320 Members | 2,048 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,320 software developers and data experts.

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
7 5576
Icecrack
174 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
410 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
174 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
410 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
4,059 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

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

Similar topics

2
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class...
7
by: Martin | last post by:
I have a situation where I'm displaying some information in a table on a web page. I've given the user the ability to make several different "queries" and show different sub-sets of the data. I...
0
by: I Decker | last post by:
Hi all, Hope this is the right group. I am writing a program in c# to open create an excel document, enter some data, save it and then email it as an attachment. I have successfully created...
6
by: Steve Richter | last post by:
I am getting error in a vbscript: ActiveX component cant create object: Excel.Application. The vbscript code is: Dim objExcel Set objExcel = CreateObject("Excel.Application") I am pretty...
2
by: TJ | last post by:
Hi, Basically, I want to create excel file on the fly, then force users to download it without using automation. Here is one of ways.. System.IO.StringWriter sw = new...
27
by: jeniffer | last post by:
I need to create an excel file through a C program and then to populate it.How can it be done?
10
by: Steve | last post by:
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied...
0
by: FireGeek | last post by:
I need to create a new Access table with columns based on an Excel file. More Information: This task will come before I actually import the Excel file data into my data base. This Excel file...
0
by: kennedystephen | last post by:
This seems like a simple task. But it's kicking my butt. I have 1 existing excel file. I want to copy the first 50 rows from that excel file, and put them in a new excel file. Then I want to get...
0
by: kennedystephen | last post by:
For the life of me, I cannot get this ... I have 1 excel document. I want to open that document and copy the first 50 rows to a new document. Then get the next 50 rows and copy those to a brand...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.