Pabbly's Gsheet Plugin:
If the row is being updated by another action script command and not manually typed into, the trigger won't activate because it only triggers when cells are manually edited by a user.
In this case, I got ChatGTP to write an Appsscript for the OnChange option to detect changes made by scripts or formulas. The script works but still only manual edits. Pabbly still doesn't hear the trigger.
function onChange(e) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var editedRange = spreadsheet.getActiveRange();
if (editedRange) {
var sheet = editedRange.getSheet();
// Check if the edited range is in column G
if (editedRange.getColumn() == 6) {
var editedValue = editedRange.getValue();
// Trigger the webhook if the value is not empty
if (editedValue !== "N/A") {
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
// Get the row index of the edited range
var rowIndex = editedRange.getRow();
var rowData = sheet.getRange(rowIndex, 1, 1, sheet.getLastColumn()).getValues()[0];
// Create an object to hold the column headers and values
var payload = {
"rowData": {}
};
for (var i = 0; i < headers.length; i++) {
payload.rowData[headers] = rowData;
}
// Add the edited column and value to the payload
payload["editedRange"] = editedRange.getA1Notation();
payload["editedValue"] = editedValue;
// Trigger the webhook
var url = "Your Webhook Here";
var options = {
"method": "POST",
"contentType": "application/json",
"payload": JSON.stringify(payload)
};
UrlFetchApp.fetch(url, options);
}
}
}
}
How do I get Pabbly to hear changes being made to cells from Gsheets scripts?
If the row is being updated by another action script command and not manually typed into, the trigger won't activate because it only triggers when cells are manually edited by a user.
In this case, I got ChatGTP to write an Appsscript for the OnChange option to detect changes made by scripts or formulas. The script works but still only manual edits. Pabbly still doesn't hear the trigger.
function onChange(e) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var editedRange = spreadsheet.getActiveRange();
if (editedRange) {
var sheet = editedRange.getSheet();
// Check if the edited range is in column G
if (editedRange.getColumn() == 6) {
var editedValue = editedRange.getValue();
// Trigger the webhook if the value is not empty
if (editedValue !== "N/A") {
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
// Get the row index of the edited range
var rowIndex = editedRange.getRow();
var rowData = sheet.getRange(rowIndex, 1, 1, sheet.getLastColumn()).getValues()[0];
// Create an object to hold the column headers and values
var payload = {
"rowData": {}
};
for (var i = 0; i < headers.length; i++) {
payload.rowData[headers] = rowData;
}
// Add the edited column and value to the payload
payload["editedRange"] = editedRange.getA1Notation();
payload["editedValue"] = editedValue;
// Trigger the webhook
var url = "Your Webhook Here";
var options = {
"method": "POST",
"contentType": "application/json",
"payload": JSON.stringify(payload)
};
UrlFetchApp.fetch(url, options);
}
}
}
}
How do I get Pabbly to hear changes being made to cells from Gsheets scripts?