1
votes

I have created a Google Sheets spreadsheet and some scripts to help me track the attendance of members at a gym.

My project has the following scripts associated: - a trigger that sends periodic events based on some checks I do and also updates some cells. This works fine I scheduled it to run daily and it seems to work properly even if my PC isn't on :D - I have also added a onEdit function that's supposed to remind the user that he/she has modified a cell and let him know that he can undo in order to revert the changes. This is the function:

function onEdit(e) {
  var ui = SpreadsheetApp.getUi(); 
  var cell = e.range; 
  var actual_cell = e.source.getActiveRange().getA1Notation();
  var row = cell.getRow();
  var column = cell.getColumn();
  var old_content = e.oldValue;

  ui.alert('Modificare celula' + ' ' + actual_cell + '.' + ' UNDO to rever the changes')
}

This, however, does not work on the mobile version: Sheets for Android. Is there any way I can make my app fully functional on the mobile version as well? I want to have that warning message that tells the user a cell was modified on the mobile version as well. How could I do that?

Also another question regarding the trigger that sends periodic emails. I have used a Time Based daily trigger that runs some function. Do I have to be logged on my account at all times on my PC(or any other device) in order for this script to run periodically? Or is it on the cloud and it will run even if I'm not logged on any device?

1
Upon some investigation I found out that the onEdit function actually works on the mobile version however is the 'getUi' class that doesn't. So I guess the new question is, is there an alternative for creating pop-up messages on the mobile version? Thanks - Cantaff0rd

1 Answers

0
votes

To be able to trigger the script bound to the spreadsheet from a mobile App (Android or iOS), you have to deploy the script as a API executable (Publish -> Deploy as API executable from menu bar in script) [1].

As stated by a Googler in this comment [2], since last year you can't display any element from the Ui class [3] in mobile versions.

About your other question: It doesn't matter if your computer is on, the script/trigger will run either way.

[1] https://developers.google.com/apps-script/api/quickstart/target-script

[2] https://b.corp.google.com/issues/36763692#comment6

[3] https://developers.google.com/apps-script/reference/base/ui