send automated data from Gsheet to Google chat space using appscript
I have a specific range in google sheet to be send on daily basis to a google chat space, here i want an appscript function that can pull out the range and send it to the chat space.
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet = ss.getSheetByName('test')
var sa = sheet.getRange(1,1,3,4).getValues()
var Webhooklink = "https://chat.googleapis.com/v1/spaces/z9qlr4AAAAE/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=Hb_1EL9SStKXYJXjU_hFaKX7lQo_vVTccW_8qCOSNOk%3D"
//var message = { text: "Hello"};
var payload = JSON.stringify(sa);
var options = {
method: 'POST',
contentType: 'application/json',
payload: payload
};
var response = UrlFetchApp.fetch(Webhooklink, options );
Logger.log(response)
} ```
Comments
Post a Comment