Receive Notifications from Google Sheets When Checkbox is Checked

Interesting....

The addition of the Description column provides context. A background notification could work this way.

1 Like

Sounds good! How do I do it? "You can simply make a timed call to the spreadsheet from your app to check if the cell is TRUE or FALSE."

This would mean that the app would need to be open (all the time), which is probably not a good thing for battery life or your users. From what you show, a notification background service is better because the app can be closed and you still get the notifications sent through. The issue is personalising the notification to the specific user...

1 Like

notification background service is better "the app can be closed and you still get the notifications sent through". Amazing!

I have the spreadsheet side of things working, just need to setup the app side.

Google Apps Script Function:

function buildMessage() {
  var ss = SpreadsheetApp.getActive();
  var sh = ss.getSheetByName('TaskList');
  var shi = ss.getSheetByName('toItoo');
  var rg = sh.getDataRange();
  var vals = rg.getValues();

console.log(vals);

  var msgs = [];
  for (var i=0;i<vals.length;i++) {
    if (vals[i][3] == true) {
      msgs.push(vals[i]);
    }
 }

 if (msgs.length > 0) {
console.log(msgs);

shi.getRange("A1").setValue(JSON.stringify(msgs));

  var alert = "";
  for (var i=0;i<vals.length;i++) {
    if (vals[i][3] == true) {
      sh.getRange("D" + (i+1)).setValue(false);
      alert += vals[i][1] + ", ";
    }
 }

showAlert (alert + " will receive messages");
 }

}

function showAlert(msg) {
  SpreadsheetApp.getUi().alert(msg);
}

I have the app side working in conjunction with my spreadsheet setup now:

The example app allows the user to set the UUID, this must be done before starting the background service, otherwise the default UUID of 101 will be used.

Then, when the tasklist in the spreadsheet has tasks ticked, a notification is sent, but only the designated UUID user will receive a message, if they have a task.

I had to do some double quote tidying up of the response content...

One should not change the data in the toItoo sheet, this helps to avoids duplicate messages being sent.

Remove all columns and rows from the sheet toItoo except for cell A1.

1 Like


Thank you so much! The Google Sheets side is working perfectly. Could you please send the .aia file for the app to check?

I'm stuck. What does 'tidy' mean?

There is a small procedure in the blocks called tidy. This cleans up the data so that it can be converted to an AI2 list of lists.

I can't find it. Could you please send the file to test?

You have to create the procedure yourself.

Is it possible without that? I'm new.

Here is a draggable block of the procedure

Click on it once/twice, the drag it onto your blocks editor. You will find the socket block in your procedures palette.

Also, I did not mention that you need to compile your app for all this to work.

GSMessageiToo_blank (1).aia (172.7 KB)

I tried, but I'm not getting a notification

Here is my gogole sheet

You are setting the wrong gid. You want to fetch the toItoo data: gid=1484678650

May be better to remove all the column and rows from that sheet as well, so that all you have is cell A1.

I did not test for multiple notifications to the same user, you may want to remove any of these first.

You also do not set the uuid, so you would only receive messages for uuid 101.



still not work!

Right, I'm using UUID 101 for testing now, but it's not working for me.