Executing Google Apps Script Functions from Mobile App

How to get google sheets script working on mobile app?

Not sure what I did, but now my onEdit trigger works on mobile! Might have been activating Deploy as API executable with delayed activation? Not sure what happened, but now the onEdit trigger works and I'm getting emails from Google Sheets with fail reports. Not sure why Google Sheets is sending me fail reports when the trigger is successful, but I'm not going to complain now that it works!

What also might be the solution was that I added the installation code:

function createTriggers() {
ScriptApp.newTrigger('onMyEdit')
.forSpreadsheet(SpreadsheetApp.getActive())
.onEdit()
.create();
}

If your triggers aren't working on the iPhone Google Sheets app, then try activating Deploy as API executable. It's found within the Script Editor under Publish and also add the installation code to your script

Google Sheets - How to run a script from iOS app?

Check-boxes will work great on the iOS interface, I have actually used this for a major restaurant with high-volume delivery orders (checking off "ready" orders and auto-texting drivers that their order is ready). The only change we need to make to your spreadsheet is to add a checkbox for each individual row.
Sample Image

The trick is to use an onEdit trigger, by renaming your function "onEdit"

Here is the script:

 function onEdit(e) {
//IF the cell that was edited was in column 1 and therefore a checkbox AND if the cell edited was checked (not unchecked):
if (e.range.columnStart === 1 && e.range.getValue() === true) {
var sheet = SpreadsheetApp.getActiveSheet(),
row = sheet.getActiveCell()
.getRow(),
rangeToCopy = sheet.getRange(row, 1, 1, 20);
sheet.insertRowAfter(row);
rangeToCopy.copyTo(sheet.getRange(row + 1, 1));
//Reset checked boxes
sheet.getRange(row,1,2,1).setValue(false);
}
}

NOTE: if you check a bunch of boxes quickly in succession, google scripts might miss some. This is fine because, they will stay checked and you will be able to see the ones that didn't run. Simply un-check and check them again to run the script as normal.

Running apps script in Google Sheet app

As far as Android is concerned, These are the ways to run a apps script.

  • Using the OnEdit trigger
  • Using Custom Functions
  • As far as custom menus are concerned, you need to create a separate Android add ons (rather separate apps)


Related Topics



Leave a reply



Submit