Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in Perl script for converting excel sheet data into a delimited f

Status
Not open for further replies.

r9ronaldo

Programmer
Jun 19, 2003
28
US
Hi All,

I am a novice to Perl Programming. I would greatly appreciate if somebody can just lead me some way on How I could handle this problem.
As of Now I recieve Excel sheet data which is updated monthly. I need to automate the process of extracting the data in Excel sheets and placing the data into a
delimited file.

AS of now I am manually converting these excel sheets into a delimited file and using that delimited file as my source for operations.

It would be of immense help if Somebody could provide lead on how to proceed on this? Any skeleton script will greatly help.

Please don't consider this as an effort of being lazy, Just an effort in learning ropes of new Programmin Language

Thanking you in Anticipation
Ron
 
I just made some minor modifications to this example from the documentation for the module: Spreadsheet::parseExcel::Simple

It's kind of crude, but it should get you started..

Code:
use Spreadsheet::ParseExcel::Simple;

$delim = "|";

open (OUTPUT,">c:/output.txt");
my $xls = Spreadsheet::ParseExcel::Simple->read('c:/test.xls');
  foreach my $sheet ($xls->sheets) {
     while ($sheet->has_data) {
         @data = $sheet->next_row;
         $line = join($delim,@data);
         print OUTPUT $line,"\n";
     }
  }
  
close OUTPUT;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top