PLz, can anybody help me to display Excel table on browser.Looks like easy task, however, the table must be edited and saved using the browser.
I've looked Google spreadsheets, but I dont know how to connect that application to my web site.
My purpose is: client opens an excel table(which is located on server machine) usin' a browser and edits it, so that th chages are saved on server machine.
PLZ,HELP!!!

Recommended Answers

All 11 Replies

Well php does not directly write to excel files however people in the past have written libraries to handle excel files. Some time ago I had to write to excel, searched and searched then found the best one seems to be located at http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10715 And the download I used was the direct php oop library and not the pear library as I find pear libraries too hard to install.

I haven't used Google Docs before but I signed in and it took me all of 5 minutes to create a test spreadsheet and to set the sharing option so anyone can view it. This has to be the simplest way to get a spreadsheet online in no time. Here is my very simple test spreadsheet:
Google test spreadsheet

You could add a link to your web site so anyone can link to the spreadsheet. You can set the sharing and editing options and provide a list of invitees who are allowed to read or edit it (any email address, doesn't have to be a google email address). If you want to let a bunch of people see it without editing, then you can provide universal access like I did. I believe there is an API that you can use from PHP if you want to get fancy and spend some more time at it. You can customize it and probably eliminate the need to invite them by email. You can also make it so that anyone who is sent the link automatically gets access (Read or Edit) priviledges. You could put this link on your website and limit access to that page to whoever you choose. You can also use that link on a restricted page of your site to encapsulate the Google spreadsheet page so it gets displayed like it is part of your site. The CMS that I use provides a "wrapper" function so it was really quick to set this up. If you are creating from scratch I guess you would use a frame.

Another approach is to use Ajax. There is a JQuery plugin called JQGrid that provides some spreadsheet-like functions. You can find the main page for JQGrid here, with the demos here

Chris

I haven't used Google Docs before but I signed in and it took me all of 5 minutes to create a test spreadsheet and to set the sharing option so anyone can view it. This has to be the simplest way to get a spreadsheet online in no time. Here is my very simple test spreadsheet:
Google test spreadsheet

You could add a link to your web site so anyone can link to the spreadsheet. You can set the sharing and editing options and provide a list of invitees who are allowed to read or edit it (any email address, doesn't have to be a google email address). If you want to let a bunch of people see it without editing, then you can provide universal access like I did. I believe there is an API that you can use from PHP if you want to get fancy and spend some more time at it. You can customize it and probably eliminate the need to invite them by email. You can also make it so that anyone who is sent the link automatically gets access (Read or Edit) priviledges. You could put this link on your website and limit access to that page to whoever you choose. You can also use that link on a restricted page of your site to encapsulate the Google spreadsheet page so it gets displayed like it is part of your site. The CMS that I use provides a "wrapper" function so it was really quick to set this up. If you are creating from scratch I guess you would use a frame.

Another approach is to use Ajax. There is a JQuery plugin called JQGrid that provides some spreadsheet-like functions. You can find the main page for JQGrid here, with the demos here

Chris

However it sometimes looks professional if you actually have a proper system on your own website so the styles and designs match your website exactly how you want it. For that reason, if I were to setup a spreadsheet system, I would use mysql databases and only ever use the excel library when downloading the database so that you can download the database as different formats including pdf, excel and html. Always beter and FASTER to make it yourself but usually harder.

Thank you guys!:)
Ok, firstly, i'll try the library cwarn23 gave me(thx!!) and then i'll share my experience with you:)))
Second, the Google spreadsheet: assume that I install apache server on server computer, which is located in a school with local lan area. No internet. So, you see, i can not use Google spreadsheet there...i need something with scripts...
You know, IE open directly xls files in a browser, but it can not save the changes on server computer=you must save the doc on your comp and only then save...try it and you'll see what i mean...
If you have any suggestions or ideas, plz, let me know. Any advise will be helpfukl for me...
=))))))

Have a shared network drive on the server people could save to. Also, now this might be complicated, if you are using IE then maybe you could develop some sort of Active-X control?

Have a shared network drive on the server people could save to. Also, now this might be complicated, if you are using IE then maybe you could develop some sort of Active-X control?

Well, all this things will do php script...Let me explain what exactly i'm going to do and how it will work:
-assume that you're a teacher in our school
-when you sign-up and create school class with student names&surnames, etc., php code will automatically create an Excel file(on server) that contains all information you entered in sign-up phase. So, client doesn't worry about place where the file is saved-php code will do this.
My problem is that i cant make the excel file editable online=>you have to download it and then upload after you worked on it...

Well, all this things will do php script...Let me explain what exactly i'm going to do and how it will work:
-assume that you're a teacher in our school
-when you sign-up and create school class with student names&surnames, etc., php code will automatically create an Excel file(on server) that contains all information you entered in sign-up phase. So, client doesn't worry about place where the file is saved-php code will do this.
My problem is that i cant make the excel file editable online=>you have to download it and then upload after you worked on it...

Well the check the library I mentioned earlier as it has a save function that you can save the file directly to the server without the client doing anything. It's at http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10715
All you need to do is call the save function/method like $worksheet->save('path_to/file.xls'); or something like that. That's just off the top of my head from when I used the library in the same fashion.

Well, all this things will do php script...Let me explain what exactly i'm going to do and how it will work:
-assume that you're a teacher in our school
-when you sign-up and create school class with student names&surnames, etc., php code will automatically create an Excel file(on server) that contains all information you entered in sign-up phase. So, client doesn't worry about place where the file is saved-php code will do this.
My problem is that i cant make the excel file editable online=>you have to download it and then upload after you worked on it...

why don't you just save in mysql all with different login names... then later on create a code to download MYSQL to EXCEL FILE if you want a report.

I have the code of Exporting MYSQL to EXCEL i can give it to you if you want.

why don't you just save in mysql all with different login names... then later on create a code to download MYSQL to EXCEL FILE if you want a report.

I have the code of Exporting MYSQL to EXCEL i can give it to you if you want.

I was going to do it exactly as you wrote...but how to make it like: when you login you can edit that Excel file(which was imported from MySQL db) online or without downloading it?????????????

I was going to do it exactly as you wrote...but how to make it like: when you login you can edit that Excel file(which was imported from MySQL db) online or without downloading it?????????????

Well you should be able to use the library I posted earlier to import the data into mysql (from memory there might have even been a tutorial in the documentation somewhere). And when downloading the excel file, you can use the library again to send it through the browser. All of this functuallity is explained in the documentation for the library I sent earlier. If you have any problems understanding the documentation then I can help you there but you should really try using the library I mentioned earlier with the documentation.

I was going to do it exactly as you wrote...but how to make it like: when you login you can edit that Excel file(which was imported from MySQL db) online or without downloading it?????????????

MYSQL AND EXCEL have the same database format with eg. you have HEADER FIELD ON TOP the same with TABLE IN MYSQL.

e.g.

NAME SEX AGE
Peter M 25

so without downloading the data you have to provide edit command on your code like UPDATE database command.

if you want exporting data or uploading excel data inside the database after they edit their excel file. Ask them to save as Excel file in CSV or TAB delimited format.. then you create automatic upload after their browse the excel file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.