Is it possible create Crud Webapp with Google Apps Script. I need to create a web table able to update and get values from Google spreadsheet?
yes its possible, you can insert, update a row, delete and retreive a row using google app scripts
try this link https://github.com/AishwaryT/Google-app-script-crud
let me know if you face any problem.
Yes absolutely it is possible.
Write a code in Google app script for CRUD operation over the Google spreadsheet (like Insert, Update, delete). accept the parameters using doGet() / doPost() method to insert/update data into the Google spreadsheet and return the updated data or any response in the JSON/XML or in the string format, deploy your app script (with "anyone even anonymous"), copy the URL of the deployed script and call to that URL from your your web application (in java script AJAX call) and get response from app script to your application.
Reference :https://developers.google.com/apps-script/
Related
Is there a way to set an App Script on a new Google Sheet via the Google Sheets API? We use pygsheets as our Python API Client for Google Sheets. Since we are using the onSelectionChange trigger to populate certain cells with a date, we would like to setup the app script after we have populated rows in the spreadsheet.
The Google Sheets API doesn't have a method to do this. You can use the Apps Script API instead, but there are a few caveats which may or may not work with your use case:
You can use projects.create to create a new Apps Script project and attach it to a Sheets file by specifying the parentId field, which is the Sheet's ID. However, there are no methods to attach a preexisting script to a Sheet. You can still use projects.updateContent to add the required script files, though.
You cannot unbind the script once it has been attached.
This API does not work with service accounts, and the user running it needs to explicitly allow it in their settings page. This is for security reasons, since allowing a malicious app to freely write scripts on your account could be catastrophic, but it adds more steps that your users would need to take in order to run your app.
I am aware that installable triggers do not execute/run on Script executions or updates via API requests. For triggers to run, the change or edit has to be done 'manually'. Is there any work-around or solution to this?
Here is my usecase:
I have designed HTML UI that accepts some data and stores that in specific spreadsheet
Since I didn't want any users to have access to backend spreadsheet (to restrict view to other's submission), I have created REST service using TIBCO Cloud Integration > Google connector that writes data to Google spreadsheet
When user submit the response, UI internally invokes above-mentioned TIBCO API and that in turn updates the spreadsheet (using my Google credentials) with response submitted by user
With this arrangement, I don't have to share my Google spreadsheet with all users and expose all submissions. I could have used Google Form, but that is too basic and my UI requirements are quite complex.
Until this point, everything works fine, but as a part of some advance features, I want some functions (written in the script of backend spreadsheet) to trigger on 'onEdit' when my API call write to the spreadsheet and that is where I am stuck. So far, I have tried:
Exposing Google Script as an REST API
Exposing Google Script as Library function
but in all cases, I have to share the spreadsheet with user that invokes the calls, and I dont want that, thanks.
Im use this Google ApiClient https://developers.google.cn/apps-script/api/quickstart/php
To pull Form & Responses, but same the api just add script to script.google
Please show me example to get the list form and Responses
Thanks
As of this writing there are no explicit REST APIs to pull Google Form data, so you won't be able to pull form responses directly from the Google API PHP client.
It you want to access form responses from PHP you'll need to use App Script to create a custom intermediary service/API that exposes the information you want.
You're already aware of the Apps Script API, so you can try creating a series of custom Apps Script functions to pull form responses and then call the Apps Script API from PHP to execute those functions to return the requisite data.
None of this is trivial to implement, and I don't have any code that I can share. But I'd start with reading the Apps Script API documentation and work out a solution from there.
I have a google apps spreadsheet, and I want to write a script that can be accessed via any browser, will generate a response using data from the spreadsheet, and return it to the browser.
I put in a lot of data in the spreadsheet that is required for my app. I want to automate the process of getting the data from the spreadsheet and integrating into the app before creating a build. Right now I run the script manually, download the result, and copy it into the app's data folder.
Ideas?
You can interact with your script via HTTP Post
doPost Trigger
Here is a little example of a doPost function
function doPost(e){
return ContentService.createTextOutput(SpreadsheetApp.openById(id).getSheetByName(name).getDataRange().getValues())
}
I have Google spreadsheet with script attached to it (with the Tools->Script Editor tool).
I want to call one of script function from external Android App. Is it possible? Should I use Spreadsheet API?
Unfortunately, you cannot directly call your script from any external application.
However, you can change it to be a web application, then invoke it via an HTTP GET or POST from almost anywhere, including an Android app.
Insert new rows into Google Spreadsheet via cURL/PHP - HOW? provides an example of a web app that you could adapt.
Should I use Spreadsheet API?
Your question doesn't actually say what it is you want to do, so the answer is "it depends". You still won't be able to invoke an embedded script using the Spreadsheet API, but you will be able to read and write spreadsheet content.
Obviously the answer depends on your usecases, but have you checked the Google Appscript API?
As stated it
provides methods to remotely execute Apps Script functions