Jump to content

PHP with Excel Document


Recommended Posts

I am currently coding a website in PHP and am looking for an easy way for a non-technical user to make changes to it. One way I thought of doing it would be to have an Excel document in the website directory and use a PHP script to read from it. Any ideas how to make this happen? Or is there a different way for me to be doing this?

Specifically, this part of the website calls for Current Job Postings. The excel document would have the name, a description, requirements, etc... in different columns of a row. Each job would have its own row. This way, I can teach a person to add a row for a job posting or delete a row. Anyways, just basically looking for a script to read an excel document and display it on a website or any other ideas on how to do this.

Thank you.

Link to comment
Share on other sites


An excel document isn't exactly a good back end/data persistence layer. It's not meant for that at all.

I am currently coding a website in PHP and am looking for an easy way for a non-technical user to make changes to it. (snip) Or is there a different way for me to be doing this?

You could do like 99.999% of other websites out there, and use a plain old database to hold the data, and plain old HTML forms to enter & edit it. Any PHP tutorial should cover this.

Edited by crahak
Link to comment
Share on other sites

I am currently coding a website in PHP and am looking for an easy way for a non-technical user to make changes to it. One way I thought of doing it would be to have an Excel document in the website directory and use a PHP script to read from it. Any ideas how to make this happen? Or is there a different way for me to be doing this?

Specifically, this part of the website calls for Current Job Postings. The excel document would have the name, a description, requirements, etc... in different columns of a row. Each job would have its own row. This way, I can teach a person to add a row for a job posting or delete a row. Anyways, just basically looking for a script to read an excel document and display it on a website or any other ideas on how to do this.

Thank you.

I first started with COM to Excel as an offline server, but too slow and needed Excel installed.

Then I created a small Macro to push the data in Excel to a DB, but too many things could go wrong.

Finally I ended up with using ODBC to talk to Excel. Now I can use all the same ODBC commands I know and love to get data out of the Excel "database". Watch out for table names. They aren't standard.

Get to grips with the odbc_tables command and other meta data within the xls file.

Worksheets, named ranges, page layouts are all tables. I'm pretty sure there are more "table" types, but I can't remember off the top of my head.

Oh. I've never bothered writing using the Excel ODBC driver. So, this my be read-only.

Link to comment
Share on other sites

I first started with COM to Excel as an offline server

Using a spreadsheet as a database possibly qualifies as the worst misuse of technology I've ever heard of... (and a very expensive one also -- $600 license of MS Office to install it on the server) Especially when your copy of MS Office already comes with a database in the first place (MS Access).

but too slow and needed Excel installed.

Yeah, using excel as a COM object has got to be super slow, it's not exactly fast to load excel on each page load... And using Excel as a COM object, you're bound to have problems with it not terminating properly and such, and eventually you'll have several instances of it running in memory at the same time, slowly using up all of the server's memory. The ODBC driver also has it's share of issues.

Then I created a small Macro to push the data in Excel to a DB, but too many things could go wrong.

If your data is properly formatted in excel, it should work just fine.

Again, everybody on this planet uses a database for this, why not use a database when you need one? It's not like basic SQL is hard to learn... Every basic PHP tutorial should cover HTML forms + simple database access (with MySQL or what not). You could easily pick it all up in a single evening.

Besides, since he's using PHP, it's likely on a LAMP server (as in Linux), where you can't even install Excel in the first place.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...