makes the trigger run the function if the chexbox is checked

58 views
Skip to first unread message

nagastar

unread,
Mar 16, 2023, 10:16:55 PM3/16/23
to Google Apps Script Community
hello guys,
I want to create a function if the checkbox in column J is checked then it will run a function to create a notification to the chatwork chat application whose contents are question column data (E) according to the checked checkbox row. for example if I check the checkbox in row J2 then it runs a function to notify sending data in row E2 to chatwork chat apps.

fdf.PNG

this is my google scripts. but not working.
function onEdit(e) {
  const sheet = SpreadsheetApp.getActiveSheet();
  const sName  = sheet.getName(); 
  if(sName === 'Q&A sheet' && e.range.columnStart == 9 && e.value == "TRUE") {
     var row = sheet.getLastRow();
  var question = sheet.getRange(row5).getValue();
       var notify_body
  = "[info][title]This question has been entered by the answer.[/title]\n"
      + "question : " + question + "\n"
    +"----------------------------------------\n" [/info]";

 var roomId = "xxxxxx"//chatwork room id
 var client = ChatWorkClient.factory({token"0c0219265533a8b8e71d160bda27ec44f"});//Enter your chatwork access token
 client.sendMessage({room_idroomIdbodynotify_body});

  }
}

Can anyone help me to fix these scripts? I have searched the internet but have not found a solution.

Riël Notermans (Zzapps)

unread,
Mar 20, 2023, 3:34:13 AM3/20/23
to Google Apps Script Community

Use onFormSubmit instead of onEdit?
Op vrijdag 17 maart 2023 om 03:16:55 UTC+1 schreef nagastar:
Reply all
Reply to author
Forward
0 new messages