having spent half of the day searching for a solution and knowing that 99.9% of problems with any language have been asked already I finally came to conclusion that this is something new...
I am trying to make simple onEdit trigger to run on google sheets on android phone. Once cell has been changed the script should activate cell below (or next n-th cell below). This solution would help anyone who is trying to quickly fill google sheet from the phone, since often it is difficult to click on cell in the spreadsheet using someones big fingers...
all solutions work on my Mac, but none on Samsung phone. First event trigger for changes in range 'B15' actually works but it does not select another cell in the spreadsheet.
Any ideas? thanks!
function onEdit(e) {
var range = e.range
// THIS WORKS, but it does not use activate method
//(it is actually piece of code I took from stackoverflow...
if (e.range.getA1Notation() == 'B15') {
if (/^\w+$/.test(e.value)) {
eval(e.value)();
e.range.clearContent();
}
}
// The following code does not work
if (e.range.getA1Notation() == 'B3'){
eval('movedown')();
}
if (e.range.getA1Notation() == 'B4'){
var tR = e.range.getRow()
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Form').getRange(tR+1,2).activate()
}
if (e.range.getA1Notation() == 'B5'){
range.getActiveCell().offset(1,0).activate();
}
if (e.range.getA1Notation() == 'B6'){range.offset(1,0).activate();}
if (e.range.getA1Notation() == 'B7'){range.offset(5,0).activate();}
if (e.range.getA1Notation() == 'B12'){range.offset(1,0).activate();}
if (e.range.getA1Notation() == 'B13'){range.offset(2,0).activate();}
}
function movedown(){
var sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Form');
var cs = sh.getActiveCell().getRow()
sh.getRange(cs+1, 2).activate()
}