Display a editable spreadsheet on a php page - php

I'm new to PHP programming language.
Currently, i want to develop a page that displays something like an excel spreadsheet (with self-defined column headers).
It allows users to key in data onto the 'spreadsheet' and when they submit it (maybe a submit button at the bottom), the data will be saved into mySQL database.
May i know if this can be done?

Use google spreadsheet API:
The Google Spreadsheets Data API allows client applications to view and update Spreadsheets content in the form of Google Data API feeds. Your client application can request a list of a user's spreadsheets, edit or delete content in an existing Spreadsheets worksheet, and query the content in an existing Spreadsheets worksheet.
http://code.google.com/apis/spreadsheets/data/1.0/developers_guide_php.html

Yes, it is possible. e.g: google docs and some other online editing/office applications. But you may need to know more than php.

try something like zoho sheet, getting data into your database will have to use something else though
https://sheet.zoho.com/

Related

PHP get Google spreadsheet data with authentication (additional: send row data to google doc)

I'm currently developing a php page that will get spreadsheet data and display it in a datatable. I have done so by publishing my spreadsheet and getting the JSON object through spreadsheet url/key.
I have been successful in doing so :
Now, I have been requested an enhancement, I need to change the functionality of the 'print pdf' button to actually get the row data and create and populate a google doc. I'm thinking that I would need authentication for that and the implementation of accessing the google spreadsheet would change. Could anyone give me a nice example cause I am fairly new with google api and php in general.
I tried to read samples from developer.google but I'm having trouble understanding them.
Thanks a lot!

Google spreadsheets with php. Get or export data from sheets with limited access

Hi all and sorry for my bad English. My task was to get data from sheets (tables) Google docs.
I export data from Google docs using URL with params:
https://docs.google.com/feeds/download/spreadsheets/Export?key=[file_id_here]&exportFormat=csv
Retrieve data from the file has no problem, but then I found out, that the real lists are restricted and this is where the problems started.
Instead of CSV file, Google returns authorization.
My question is how to organize the connection to Google api with token client if the client has the right of access to the document, the document data is displayed , otherwise, "You do not have permission to view the document!" message appears. OR Maybe it is possible to add parameter(client token) to URL, though this is not possible.
Any help appreciated.

delete spreadsheet on google drive from website

I am using a MySql database and google spreadsheets together. Each record in my MySql database has a corresponding google spreadsheet for aditional datas. On my website I have displayed the datas and included the spreatsheet by iframe.
From my website I edit and delete the records by php-script. After deleting a record from my database I go to google drive an delete the corresponding spreadsheet.
Is it posible, to delete the spreadsheet as well with the same php script from my website? If yes, how can I do it?
Yes, definitely you can. You may create an Apps Script and publish it as a webapp. Now you can call the wepapp URL from PHP using curl and pass the ID of the spreadsheet to the Weapp. App will take the ID and do the required action. Webapp code will look something like
function doGet(e){
var ssId = e.parameters.ssid;
var file = DriveApp.getFileById(ssId);
DriveApp.removeFile(file);
return ContentService.createTextOutput('File removed').setMimeType(ContentService.MimeType.TEXT);
}
For more details, check Apps Script Content Service.
https://developers.google.com/apps-script/guides/content

Build a survey system on top of google forms

We built a survey tool on top of google forms using wordpress.
Simply, you create a google form, create a private open link, put into a wordpress backend page, then the system processes the module server side and generates the necessary html file. When the user fills the form and sent it, via ajax the server use zend gdata to write the results on the spreadsheet connected to the form et voilat.
But this system is limited, also because google form is quite limited. We want to improve it.
That's why I'm asking your opinions to upgrade the system to have some more features:
We want to be able to keep the form open so that users can fill it in more than one occasion. theoretically then, we need to know which user the spreadsheet rows are connected to. This could be done by saving some sort of ID key to recognize the user, but then we don't know how to refill the fields in the form, since the spreadsheet created from the forms don't retain any sort of key to connect columns and form field.
We need more field types! like a file upload field that put the uploaded file in a specific gdrive folder.
We need to see the data for the single entry while google gives you only the whole spreadsheet that's quite hard to read.
It's not an easy task! Which solutions should we use to solve these problems?
Many thanks!
UPGRADE:
We decided to go by using a mix of google forms, google fusion tables, google charts via api access. Here's the simplified algorithm:
The admin user create his form via google forms and save the url. To have more field type, user can put a tag in the field comment, eg [file] for, well, files upload.
The url is put into an admin page of our system. The page fetch the content of the form page and extrapolate into an array, for every field, the title, the ID, the type and the comment; if there's some tag in the comment, this become the field type.
Using this data, system create if not existing a folder with a fusion table inside. if file fields are present, another subfolder is generated. Addresses of these folders and files is saved.
Using the array data, in the fusion table a column is created for each of the array fields, with a column title of this sort "[field_ID field_type]field_title", plus a column for the end user ID.
The admin user, can more over open or close the form.
When a user goes to the form page, the array is used to generate the form. If the system doesn't have in memory the user ID it means that the user has never filled up the form. Otherwise the system will use the user ID to fetch the data from the fusion table to populate the form.
When the user fills up the form, the entries are feed to the columns using the field ID as reference, plus the user ID. The user ID is also stored in the system the remember that the user already filled the form, as said in point 5. If files are uploaded, they are stored in a gdrive folder.
The admin user therefore can go to the admin page and see how many people has filled up the form, can ask for single user data, for summary data using google charts, can download a pdf of data from single user, every user, or summary.
Of course this is the idea, we have to build it. One first question is whether we should use javascript or php to communicate with google, so doing the processing on the client or server side...
If you're asking about Javascript vs PHP, you should know that the Javascript API can't write to a Google Spreadsheet because of Cross-Domain Security issues.
PHP can as it is a server side language. Zend Framework makes it easy to interact with Google Spreadsheets. http://framework.zend.com/manual/1.12/en/zend.gdata.spreadsheets.html
So go with PHP if that was your question.

post form to url and database or url

I have a form that I host . To meet my clients needs I must post to specific url .I wuld like to be able to post to a dattabase or google spreadsheet at the same time so I can track results
What I would do is log the data in the database, and then provide a feed for the Google Spreadsheet.
Google Docs Spreadsheets are capable of loading various formats of data over HTTP. You can provide a feed of that data, and the spreadsheet will automatically update as new data is available.
For example, in your spreadsheet:
=importHTML("http://www.google.com/search?q=define:live", "list", 1)
Example from: http://googlesystem.blogspot.com/2007/09/google-spreadsheets-lets-you-import.html

Categories