Part of the EllisLab Network
   
1 of 4
1
Reading Excel Files
Posted: 03 January 2007 08:47 AM   [ Ignore ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

Has anyone encountered a need to read and parse excel (real .xls, not .csv) files?

I have the need of this, but before I tackle this myself I was hoping someone had already accomplished this.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 03 January 2007 09:34 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  207
Joined  12-22-2006

I have seen it somewhere. Cannot really remember where. Think it was on an intranet application I was working on a while back. Perhaps you can find something in PHPClasses.org. Btw if you happen to tackle it I wouldnt mind seeing the result raspberry

Profile
 
 
Posted: 03 January 2007 11:39 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  621
Joined  03-20-2006

I have had a good look around for excel writing classes, they are few and far between to say the least. If you find anything i would like to know!

Profile
 
 
Posted: 03 January 2007 11:41 AM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

Actually, I need one to read excel.  In the past I’ve used the excellent Excel reader (http://sourceforge.net/projects/phpexcelreader) but I was just hoping that someone had already taken it and coded it up as a CI library.

Thanks both.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 03 January 2007 12:28 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  621
Joined  03-20-2006

Hmm looks like there is a tiny but strong template plugin for writing excel, i am sure i saw tiny but strong on the wiki. http://phpclasses.fonant.com/browse/package/3159.html

Not much help for your reading but might be of some use to somebody.

Profile
 
 
Posted: 03 January 2007 01:22 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

I’ve been working on making an Excel reader for CI, but it hasn’t been a high priority for me because I wasn’t sure if there was any demand for such a thing.  If there are people who want one, maybe I will try to finish it soon.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 03 January 2007 01:27 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
RankRankRank
Total Posts:  970
Joined  04-13-2006
cloudbreak - 03 January 2007 01:22 PM

I’ve been working on making an Excel reader for CI, but it hasn’t been a high priority for me because I wasn’t sure if there was any demand for such a thing.  If there are people who want one, maybe I will try to finish it soon.

Derek is demanding! Actually I gave up on this myself a few months ago as I couldn’t find an acceptable open source tool, although I seem to remember there are commercial ones. I settled for using a csv export from Excel, rather than the .xls itself.

Profile
 
 
Posted: 03 January 2007 01:44 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

Alright, I will try to finish a beta version of my Excel reader within the next few days.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 04 January 2007 08:29 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

Thanks cloudbreak, that’d be cool.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 04 January 2007 11:14 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  96
Joined  01-01-2007
Derek Allard - 03 January 2007 11:41 AM

Actually, I need one to read excel.  In the past I’ve used the excellent Excel reader (http://sourceforge.net/projects/phpexcelreader) but I was just hoping that someone had already taken it and coded it up as a CI library.

Thanks both.

Is that the one that is included with XAMPP? Cause it is pretty good.

 Signature 

Arguing on the Internet is like running in the Special Olympics, even if you win you’re still retarded

Development Server (my laptop) WAMPP | CI 1.5.1 | Rapyd |

Server: UNIX | PHP 5 | Mysql 5 | Postgres

Profile
 
 
Posted: 05 January 2007 07:34 AM   [ Ignore ]   [ # 10 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006
aceofspades - 04 January 2007 11:14 PM

Is that the one that is included with XAMPP? Cause it is pretty good.

You know… I don’t know. Does xampp include an excel reader? I checked their site but I don’t see any mention of this.  Could you provide more info?

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 08 January 2007 08:44 AM   [ Ignore ]   [ # 11 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006
cloudbreak - 03 January 2007 01:44 PM

Alright, I will try to finish a beta version of my Excel reader within the next few days.

How’s this going cloudbreak?  I need it for my own project, so I’m wondering if there’s anything I can do to help you out here.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 08 January 2007 12:07 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

Progress is proceeding, but a bit slower than I hoped.  I’ve found all the documentation on the excel format that I need (thanks to openoffice.org), but it took me all weekend to fully understand it all.  I’m almost to the point where I can read the data from a spreadsheet (just the data, not any formatting or formulas).  Once I can pull the data into an array for easy access, I will release what I have.  Other features, such as reading fonts and formatting and outputting the spreadsheet as html will take a bit longer.  If there are any specific features you need for your project let me know and I will prioritize them.

Also, if someone could give me some tips on releasing code for CI, that would be helpful.  I haven’t done this sort of thing before.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 08 January 2007 03:52 PM   [ Ignore ]   [ # 13 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

Hey, reading data is all I need (I don’t care about formatting). smile

I’d be glad to offer suggestions as to how to release as best I can.  If you want to contact me privately I’ll do what I can for you.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 09 January 2007 11:15 AM   [ Ignore ]   [ # 14 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

To anyone following this, here’s how I implemented a “stop gap” for reading xls files until a more elegant solution can be made.

1) I downloaded PHP-ExcelReader, and put the files into my root directory beside index.php.
2) In my controller I use

require('Spreadsheet_Excel_Reader.php');
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251'); // Set output Encoding.
$data->read($filename); // relative path to .xls that was uploaded earlier
    
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
     
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
          
echo "\"".$data->sheets[0]['cells'][$i][$j]."\",";
     
}
echo "\n";            
}

I know it isn’t a library or anything, but it get’s me where I need to be right now. wink

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 11 January 2007 10:40 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

I’ve finally finished the beta version of my spreadsheet reader library. 

However, I’m not sure how to make it available for download.  Can I add it to the CI wiki or is there a better way?  It’s only one file, but I think its too much to copy and paste into a post.  I’m still working on my personal website so that’s out.  I guess if anyone wants it just let me know and I can email it?  Sorry for the confusion, but I haven’t contributed any code here before.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
   
1 of 4
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66379 Total Logged-in Users: 24
Total Topics: 84696 Total Anonymous Users: 2
Total Replies: 454579 Total Guests: 209
Total Posts: 539275    
Members ( View Memberlist )