-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappscript.js
More file actions
31 lines (24 loc) · 897 Bytes
/
appscript.js
File metadata and controls
31 lines (24 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const WEBHOOK_URL = 'https://17df-2401-4900-8838-1bfc-4cb-4eaf-568e-5675.ngrok-free.app/webhook'; // Replace with your Flask webhook URL
function onEdit(e) {
var event = e;
var sheet = e.source.getActiveSheet();
var range = e.range;
var values = range.getValues();
// Prepare the data to be sent to the webhook
var data = {
event: event,
sheetName: sheet.getName(),
range: range.getA1Notation(), // Get the A1 notation of the edited range (e.g., 'A1:B2')
values: values
};
sendWebhook(JSON.stringify(data));
}
function sendWebhook(payload) {
var options = {
'method': 'post',
'contentType': 'application/json',
'payload': payload
};
// Send the POST request to the Flask webhook
UrlFetchApp.fetch(WEBHOOK_URL, options);
}