Reputation: 231
I've perused the forum and haven't found any definitive answers (other than to write an Android script, but I have an iPhone). From what I've read on this wonderful forum, the onEdit and onChange triggers should work on the mobile app.
My script works fine when I use the desktop app. However, when I use the Google Sheets mobile app, the scripts do not run. How can I get them to run?
This solution was to create an Android add-on, but I have an iPhone. Maybe this is a stupid question, but can I run an Android add-on on my iPhone Google Sheets mobile app? I'd assume no since the OSs are incompatible, but weirder things have happened.
This solution says to change the simple onEdit
trigger to an installable one. What is an installable trigger?
This solution says to create a web-app using Google's Execution API. Not sure how to do this.. I thought I already did. Within script editor> Publish
> Deploy as web app
. I've also done Publish
> Deploy as API executable
. Am I doing something wrong?
My script:
function onEdit(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("pss");
var lr = ss.getLastRow();
var range = ss.getRange("A2:J" + lr);
var vlst = range.getValues();
range.setValues(vlst);
var i,j,a,find,repl;
for (var i = 0; i < vlst.length; i++){
for (var j = 0; j < vlst[i].length; j++){
a = vlst[i][j];
if (a == find) vlst[i][j] = repl;
find ="sun";
repl ="sunshine";
}
}
Upvotes: 0
Views: 12720
Reputation: 231
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
Upvotes: 1