CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Merging a CSV File to XLS.

 



dinjo_jo
Novice

Dec 16, 2008, 12:53 AM

Post #1 of 8 (667 views)
Merging a CSV File to XLS. Can't Post

Hi All ,

I need to merge the data contents of a csv file into a XLS file which already has data.

Don't want to parse the entire contents of CSV file.

Thanks

D J


FishMonger
Veteran / Moderator

Dec 16, 2008, 5:03 AM

Post #2 of 8 (662 views)
Re: [dinjo_jo] Merging a CSV File to XLS. [In reply to] Can't Post

So what's stopping you and what is your question?


dinjo_jo
Novice

Dec 16, 2008, 7:10 PM

Post #3 of 8 (654 views)
Re: [FishMonger] Merging a CSV File to XLS. [In reply to] Can't Post

How do i that in Perl ?

There is a Excel sheet which has data in three worksheet , I need to put the data of a csv file in the 4th worksheet.


FishMonger
Veteran / Moderator

Dec 17, 2008, 6:45 AM

Post #4 of 8 (644 views)
Re: [dinjo_jo] Merging a CSV File to XLS. [In reply to] Can't Post

Have you looked at any of the excel modules on cpan?

If you want a platform independent module, then look at:
Spreadsheet::ParseExcel
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.41/lib/Spreadsheet/ParseExcel.pm

If you want an MS specific module, then look at:
Win32::OLE
http://search.cpan.org/~jdb/Win32-OLE-0.1709/lib/Win32/OLE.pm


dinjo_jo
Novice

Dec 17, 2008, 7:26 PM

Post #5 of 8 (621 views)
Re: [FishMonger] Merging a CSV File to XLS. [In reply to] Can't Post

This is for Parsing XLS File which i already know.

I need to push the data of the csv file to a xls file


FishMonger
Veteran / Moderator

Dec 17, 2008, 7:53 PM

Post #6 of 8 (619 views)
Re: [dinjo_jo] Merging a CSV File to XLS. [In reply to] Can't Post

You obviously didn't read the documentation, specifically the doc for Win32::OLE which can not only be used to parse the spreadsheet, it can also modify an existing xls file or create a new xls file.

Another module that you should look at is Spreadsheet::WriteExcel which is platform independent and is used to create a new xls file, but doesn't modify an existing file.

CPAN is one of the most important Perl resource and should be the first place to look.


dinjo_jo
Novice

Dec 17, 2008, 9:02 PM

Post #7 of 8 (616 views)
Re: [FishMonger] Merging a CSV File to XLS. [In reply to] Can't Post

I have used SpreadSheet::WriteExcel , but i doubt Win32::OLE would help as i need to read a csv file and amend the data in a xls

I'll still give it a try.Smile


FishMonger
Veteran / Moderator

Dec 18, 2008, 12:24 AM

Post #8 of 8 (611 views)
Re: [dinjo_jo] Merging a CSV File to XLS. [In reply to] Can't Post

I'm at a complete loss to understand why you think this is going to be difficult or problematic. First of all, Win32::OLE would not be used for the csv parsing, it would be used to update the xls file. There are several modules on cpan that assist in parsing the csv file, but it's very common to simply open a filehandle to it and process it line-by-line and update the xls file as needed while you're parsing the csv file.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives