develooper Front page | perl.beginners | Postings from May 2007

Outlook CSV Parser

Thread Next
From:
Laxminarayan G Kamath A
Date:
May 29, 2007 22:40
Subject:
Outlook CSV Parser
Message ID:
20070530111000.d2025b70.laxminarayan@deeproot.co.in

Hi PERLers, 
	We here at DeepRoot Linux were trying to parse Outlook's csv so
that I can add them to ldap addressbook.. After several futile tries
around with lots of built in packages, we decided it was up to us to
device an algorithm. As time was of importance , we wrote a "well it
works!" "character by character" parsing perl algorithm. 
        Wondering about how I could make it run faster, I thought I
will give regular expressions a try. The attached file is what I have
come up to.. but it still takes more than 10 seconds on my 1.6 GHZ P4
with 1G RAM to parse a 6500+ lines of CSV . and seperate them  out ..
Let alone importing them to LDAP. Any ways of optimising it further?
	The stubling blocks : there are several types of problems in
Outlook's CSV .. 
	1. One line need not be one record. They may cointain multine
fields.
	2. A sigh of relief but : only multi-line fields are wrapped in
double quotes.
	3. commas are both inside and outside the fields. the ones in
the fileds must not be treated as "seperator" - again fields with
commans are wrapped in double quotes.
 
I hope I am on the right mailing list.. Else, please direct me to the
proper one.

-- 
Cheers,
Laxminarayan G Kamath A
e-mail: laxminarayan@deeproot.co.in
Work URL: http://deeproot.in

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About