I want to use a certain Google Spreadsheet as UI for a Cloud Function. For Example, I want the columns "SQLStatement", "TargetSheet" and "TargetCell" such that my colleagues can handle a GCFunction only with their SQL skills and write the results into the Google Sheets of their desire.
The script that reads the statements and writes the results is working, my problem is the trigger. The Cloud Function shall be triggered by every update of the source spreadsheet, I do not need any information to be pushed to the function.
I am doing research since a couple of days, but the more I read about Firestore, Appscript and Cloud Function Triggers the more confused I am and the farer I get from my original problem. Hence, my question is:
What is the easiest way to trigger a cloud function by an update of a certain Google Spreadsheet?
Thank you in advance!
There is no built-in trigger type to run a Cloud Function upon a change in Google Sheets.
If you want to invoke a Cloud Function upon such a condition, you will have to write the Apps Script code to respond to an onEdit event, detect the condition in that code, and then call your Cloud Function (typically a HTTP based one as shown here).
Related
I am writing a Nodejs application that connects to a webhook of a Discord channel. The webhook takes the row of the spreadsheet and posts the data to Discord.
This was easy to implement with the Google Sheets API but the next task requires our app to monitor Google Sheets and invoke the webhook as soon as a new row is added to sheets.
I've explored the Sheets API and found no feature that sends a notification when a new row is added. Automation tools like Zapier and Automate.io offer this sort of functionality so it should be possible.
Any suggestions on how we can trigger our Nodejs app when a new row is added to Sheets?
One way is to create an installable trigger to run an Apps Script function when an on change event happens.
You may want to take a look at the getEventObject_ function to learn how to get the event type, modified spreadsheet range and its values from the event object.
I Cant find any workable solution. Can anyone help? Need to make translate from 1st sheet in one doc to the second. About 60.000 changeable rows.
You can use the Google Translate function directly in your sheet
If you want more advanced/customized calls, I recently wrote an article where I use the current user credential and I call a Google Cloud API (not the translate, but the principle is the same)
I am trying to build this app where I am planning to store my data in a Firestore database. My client needs the data in a Google Sheet.
Can I use Cloud Function to directly populate the records from Firestore to a Google Sheet and whenever a new record will be added to the Firestore, Google Sheet will be updated automatically?
Can anybody suggest any resource that can help on this topic?
Yes, you can use cloud function with Firestore trigger that is notified when your firestore document is changed, in the function you would call google API to update google sheets.
You can find an example of end to end tested cloud function app with firestore triggers.
While the other options provide ways to do it with code, you may want to also look into using a service like Zapier which takes about 30 seconds to set up and requires zero coding.
Setting Firebase updates to trigger to Google Sheets is supported out of the box and should do what you want really easily.
Check this link:
https://zapier.com/app-directory/firebase/integrations/google-sheets
The best way would be to create a service account that can communicate between the Firestore database and the Google Cloud function. The Google Cloud Function can then update a Google Sheet using the Google Sheets API. As for resources to put you on the right track:
How to read/write to a google sheet.
Service account docs.
And lastly, I found this similar case that should answer any other questions you have.
Is it possible to create trigger on selection, for google script in slides?
Nope. Triggers only works on Google Docs, Sheets, or Forms files as per documentation.
I have a Google sheet with a list of information on customers, one being a user count from a WaaS I run.
I would like to regularly run a script that makes a http api request that returns the user count from the platform and updates the value in the Googlesheet.
How easy is this?
I never worked with the Google Sheets API, but the documentation looks good. I hope this will help, https://developers.google.com/sheets/