The following code activates the correct cell when viewing/editing a Google Sheet on a Windows laptop through Chrome.

However, the cell will NOT activate with viewing/editing the same spreadsheet on an Android device through the Google Sheets app. Does anyone know if this is intentional, or is it a bug on their part, or a problem with my code?

function setActiveCell() { if (sheetName.getRange('B4').getDisplayValue() == '') { sheetName.getRange('B4').activate(); return; } for (var x = 5; x < 30; x++) { if (sheetName.getRange('B'+x.toString()).getDisplayValue() == '') { sheetName.getRange('B'+(x-1).toString()).activate(); return; } } }

Also, alert method of opening a info box does not work on Android, but does on Windows and chrome, specifically this code:

SpreadsheetApp.getUi().alert('text')

All the rest of my code works properly in both cases.

Jean-Louis Bontront's user avatar

Google Apps Script methods related to the user interface, like SpreadsheetApp.Range.activate() don't work on Android, however, onEdit simple and installable triggers might work while they don't use UI methods.

The above was not mentioned on the official documentation for years, but it has been updated "silently", so it might be added somewhere. I say "silently" because there are no notifications or a list of changes made to the documentation.

Wicket's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.