Jump to content

Recommended Posts

If your server is a Windows machine running > PHP5.0, you can use a .xls workbook directly by loading it as a COM object.

 

Something like:

$excel_app  =  new  COM("Excel.application");

 

You can then do what you want with the data, check the PHP manual for full info here

 

However, as it's unlikely your server is running Windows and doing this will make your code extremely unportable (only ever going to work on a Windows box, which lets face it, aren't all that common in the PHP world) I suggest you follow the advice above and export the files as CSV, which not only is more portable, but far far easier to manipulate/get into MySQL.

 

Just though I'd let you and anyone else that may want to try it, that it is actually possible to work directly with a .xls (and other) file type.

If I use the COM method on my PC it works fine. If I try it on the network web server, also Windows, it doesn't.

 

I assume the difference is that my PC has Excel application and the network server does not.

 

 

http://web.informbank.com/articles/technology/php-office-documents.htm

If I use the COM method on my PC it works fine. If I try it on the network web server, also Windows, it doesn't.

 

I assume the difference is that my PC has Excel application and the network server does not.

 

 

http://web.informbank.com/articles/technology/php-office-documents.htm

 

Quite possibly you have to have some installation of Excel on the machine you're attempting to run the COM code on. My mistake, hadn't thought of that, thanks for pointing it out!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.