View Full Version : Excel Processing

01-09-2008, 05:43 PM

Looking for help with reading/processing/writing Excel in PHP.

Have post on this at:


All help appreciated!



01-09-2008, 06:07 PM
It looks to me like there are many methods,
some better than others. I guess it's important
to know if you have your own server or not.
I mention that because there might be some PHP
modules / classes / libraries that do it all.
Not sure if all webhosts have things installed for Excel.

I assume you've looked at this?

I should have read your post more closely.
I now see you've been trying many things (viewing codewalkers forum).
Sorry I can't provide any more help than the codewalkers is giving you.


01-09-2008, 06:33 PM
IF (big if) VBA runs when you access excel using COM - http://www.php.net/manual/en/class.com.php (I see a little commented out COM in your code), then you should be able to do what you want directly without relying on any third-party code classes.

Here is an example I found (starting on page 6) - http://sydphp.org/presentations/010606-excel.html

01-31-2008, 04:07 PM

Maybe you didn't notice, but this project turned out to be much larger than I thought.

Anyway I finally got all the reading done and now working on writing the second file.

I had to break up the output into two (2) MySql tables as 1.) one table deals with header and footer information, for both input and output EXCEL files and 2.) the second table deals with itemized rows.

In particular this is a problem as you notice the output EXCEL file only has ten (10) rows to write into, and the input EXCEL file has 300 rows of data. Now selection (query) of data from the first input file is on the "QTY" column, which we ignore if blank, so usually less than 10 rows are active. But when more than 10 row result from the query, then new rows have to be inserted into the output EXCEL file, conserving the formatting from the row above and then renumbering column one, for all remaining detail item rows.

I'm uploading the source for where I'm at. I used:

TBS to open/view the source file,
Excel Reader to read my values

but now have to find a different class to write with.

If you have a single class that can do it all, it would be helpful and jumping in here to help will be appreciated.

I tried but limit on filesize is 50kb and source files are too large zipped. First file is at:


Will find another place to put second one and post link here.



01-31-2008, 04:12 PM
All files at:


03-13-2008, 06:24 AM

Hey I got all it working but the write to the new SS.

On the subject of write, when I look at all the docs on the Excel Writer Classes, everyone assumes new file, new workbook, new worksheet.

Nothing could be further from my situation! I have a .XLT template with a specific "NAMED" worksheet that must be written to.

Therefore none of the docs fit my problem and I have not yet figured out how to find my worksheet in the writer. Finding worksheets seems to be a "READER" function not a "WRITER" function, so I seem to be at an impasse right now!

Suggestions on how to approach or solve this portion would help me get around my current road block.

All help greatly appreciated!!!



03-21-2008, 06:44 PM

Harish at:


suggested I use the PEAR class, get it working and then extract the class code to my other class libs when it works.

What do you think?