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
Related
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!
I'm creating this Cordova (Phonegap) app where I store users personal data (username and scores) every 60 seconds after which I want to display all users data to everybody (like scoreboard). For this I obviously need something to first gather all the data from users and then showing it to everybody.
I tried sending data with ajax to php for database storage. Then I tried sending data with ajax to php file to write the data in file, and finally realized that ajax won't work locally(?) (yes, I'm a novice). How do I create this kind of "global memory" that is accessible by all the users? How this is normally achieved in apps? I'm open for ideas.
Thanks.
You need a backend service, and call it from your application with webservices. You should send the data to your server (via webservice), store it in a database, and generate another call to send the scoreboard to every user.
Google about Rest APIS, choose the one you like.
For storing into the app, using localstorage is OK if the data is not too big. If it is, maybe you need to use SQLite, accesible from the cordova API.
Is there a possible way where I can retrieve a list (with thumbnails) of my latest videos from youtube, store the embed code in a database using a cron job so I can show the video on a separate page instead of leading the users to youtube to view the videos? (all in php)
you can try to have a look at this page: https://developers.google.com/youtube/v3/
Google writes that:
You can use the API to fetch search results and to retrieve, insert, update, and delete resources like videos or playlists.
I saw thath PHP API are still in beta version but you can try it out. You must register your application to obtain credential to use API. At developers.google there is a lot of documentation and some examples (https://developers.google.com/youtube/v3/code_samples/php#retrieve_my_uploads)
Using API you don't need to retrieve code and store it into database, you can just show videos directly in your web application. I hope this is what you was looking for let me know if it helps!
Luca
I have the website is hosted by Web Server. I use PHP and Mysql. And I also register and upload my data in formhub.org. Formhub allow us to export data to CSV.
My purpose, I want to automatic import the latest CSV file in Formhub or mean the latest data to my Mysql Database.
So When I upload data from Smart Phone through the customize From in Formhub.org, It will automatically update to my web base online.
How Could I do? Who can help me? Please Please give me the best solution and suggestion for this purpose.
Why not using the REST services formhub provides?
info at https://github.com/SEL-Columbia/formhub/wiki/Posting-To-External-Site
In this way, each form data is stored to your formhub and also by POST to a script anywhere you like and you can process it in your php (e.g your own mysql db).
with php you can collect the data with
$entityBody = file_get_contents('php://input');
like explained here: How to get body of a POST in 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/