Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Tuesday, October 4, 2011

Parse EXCEL tools under Perl.

This is a sample Perl Program to parse/read excel.

#!/usr/bin/perl -w

use strict;
use Spreadsheet::ParseExcel;

my $oExcel = new Spreadsheet::ParseExcel;

die "You must provide a filename to $0 to be parsed as an Excel file" unless @ARGV;

my $oBook = $oExcel->Parse($ARGV[0]);
my($iR, $iC, $oWkS, $oWkC);
print "FILE  :", $oBook->{File} , "\n";
print "COUNT :", $oBook->{SheetCount} , "\n";

print "AUTHOR:", $oBook->{Author} , "\n"
 if defined $oBook->{Author};

for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++)
{
 $oWkS = $oBook->{Worksheet}[$iSheet];
 print "--------- SHEET:", $oWkS->{Name}, "\n";
 for(my $iR = $oWkS->{MinRow} ;
     defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
     $iR++)
 {
  for(my $iC = $oWkS->{MinCol} ;
      defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
      $iC++)
  {
   $oWkC = $oWkS->{Cells}[$iR][$iC];
   print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC);
  }
 }
}

Usage : Type "Path_to_perlfile Excel_filename_that_need_to_be_parsed.xls", in terminal window to read and display contents of an excel file.


Before that you need to ensure that the supporting modules are installed already. Under Ubuntu, the modules can be installed using command "sudo apt-get install libspreadsheet-parseexcel-perl" OR you can download the sources and copy the same to standard location of perl.

Friday, November 26, 2010

Fast Mail Merge - Openoffice.org extension.

There is a new extension tool to Openoffice.org called Fast Mail Merge. This will help you to send multiple email messages within a short period of time. In addition to that it provides enhanced features for existing Mail Merge Options.

If you need to download the extension file from the link given below,

http://extensions.services.openoffice.org/e-files/1082/7/FastMailMerge-0.8.1.oxt

To INSTALL, Select Tools-->Extension Manager under Openoffice.org software and add....

To work on the tool, open a Openoffice.Org spreadsheet database and Select the FMM button just under File Menu. This will open a small widow wizard which will ask for some inputs. Proceed with your options.