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

Invoke PERL from unix/linux, process and writing o/p data Excel sheet (Spread sheet)

P: 1
Hi,
I know basic perl (regular expressions, pattern matching, string manipulation, reading writing into text files).

Yet, my requirement is to read an input text file -> process this input file through a Perl script and the output generated from this script is to be written into an Excel sheet file (into each cells of the sheet).

Can you please provide me pointers on this. Example code for reading and writing into Excel (spread) sheets using PERL would be of great help.

I want to execute the PERL script from Unix / Linux OS.

Thanks,
Venu.
Sep 13 '07 #1
Share this Question
Share on Google+
1 Reply


Kelicula
Expert 100+
P: 176
I believe that excel is able to process CSV files, so you should create a "comma separated values" file with the perl program. Like so:

Expand|Select|Wrap|Line Numbers
  1. open(INPUT, "<theFirstFile.ext") or die "could not open: $!";
  2.  
  3. # do what ever
  4.  
  5. close(INPUT);
  6.  
  7. open(OUTPUT, "theFile.csv") or die "could not open: $!";
  8.  
  9.  
Make sure you separate all the cells with a comma in your output file.
Open a CSV file and examine how it is constructed. (I really don't know)
Then mimic that with your perl output.

Here ya go Click here

Than Excel will be able to open the theFile.csv file and display it properly.
Sep 13 '07 #2

Post your reply

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