Google Sheets button that activates an scenario

I want to create a button on a google sheets so that when you click it, that google sheet updates according to an scenario on

I want to avoid the minute by minute automated update for some scenarios that are consuming a lot of data and what I just need is a button than updates de google sheet whenever is needed.

Interesting :slight_smile: to accomplish this you will need to create an AppScript function on your Google sheet.

Your function could looks like this:

function onEdit(e) {
var sheet = e.source.getActiveSheet();
var row = e.range.getRow();

// Specify the URL to send the POST request
var url = “https://YOURWENHOOKURL”;

// Retrieve the data from the updated row
var rowData = sheet.getRange(row, 1, 1, sheet.getLastColumn()).getValues()[0];

// Convert the rowData to JSON format
var payload = JSON.stringify(rowData);

// Set the options for the POST request
var options = {
method: ‘post’,
contentType: ‘application/json’,
payload: payload

// Send the POST request
UrlFetchApp.fetch(url, options);

and then you can activate like this:

To set up the function in your Google Sheets:

  1. Open your Google Sheets document.
  2. Go to the menu bar and click on “Extensions”, then select “Apps Script”.
  3. In the Apps Script editor, paste the provided code.
  4. Save the script by clicking on the floppy disk icon or by pressing Ctrl + S.
  5. Name your project by clicking on the “Untitled project” text and entering a name of your choice.
  6. After saving, find the clock icon (Triggers) in the toolbar and click on it to create a trigger for the function.
  7. Click on the “+ Add Trigger” button.
  8. Configure the trigger settings as follows:
    • Choose the function name (“onEdit”) from the drop-down list.
    • Select the event type as “On edit”.
    • Choose “Head” or “Run” depending on your preference.
  9. Finally, click on the “Save” button.

From now on, whenever a row is updated in your Google Sheets document, it will trigger the onEdit function. This function will then send a POST request to the specified URL, containing the updated row data. Don’t forget to replace “” with the actual URL where you want to send the POST request.