0

Well, the task is quite simple: go to last row of the sheet. Apps Script works perfect in the desktop web app (Google Chrome at MacOS), but works partially on the mobile (Android 12, native Sheet app from Google) -- it calculates data, changes necessary cells, but doesn't move cell selection. And no errors.

function gotoDown() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var newRow = spreadsheet.getLastRow()+1;
  var range = spreadsheet.getRange("A" + newRow);

  spreadsheet.setCurrentCell(range);
};

I researched approaches here 1 & here 2 & here 3. Even simplified script: (I suspected that mobile screen might be too small to scroll down whole table as an active)

...
  var range = spreadsheet.getRange("A3");
  range.activate();

doesn't work on mobile also.

regarding link #3 above I'm using an installable trigger to activate gotoDown()

Nebobrod
  • 11
  • 3
  • Yeah a lot of things don't work on the mobile that work on the desktop. – Cooper Aug 17 '23 at 16:46
  • I agree with @Cooper. Essentially, the trigger runs, but certain Apps Script methods, such as setCurrentCell(), will only take effect on the Web UI view of Google Sheets and not in the mobile app version. Can you further clarify why you are specifically trying to jump to the last row of the section? – SputnikDrunk2 Aug 17 '23 at 18:18
  • Thanks @Cooper Isn't there really no way? – Nebobrod Aug 18 '23 at 09:17
  • Thanks @SputnikDrunk2 It's a pity. I just need to scroll down my private dictionary for adding a new word definition :) And since it's growing, manual scroll becomes irritating. Well I'll wait if someone can recommend something for set focus. And if not I'll have to just reorder my list and make a function which inserts first row (shifting down hundreds of others -- but I as doubt its effectiveness as reasonability thou). – Nebobrod Aug 18 '23 at 09:28
  • For the time being, you may also submit [a feature request](https://developers.google.com/issue-tracker) for this. – SputnikDrunk2 Aug 21 '23 at 12:15
  • 1
    hmm.. that's interesting, well I doubt of course, but let's just see: [link](https://issuetracker.google.com/issues/296999844) – Nebobrod Aug 22 '23 at 16:01

1 Answers1

0

How about a workaround like this?

function gotoDown() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  //Remove Previous Data Visualizer
  spreadsheet.getRange("A"+spreadsheet.getLastRow()).setBorder(false,false,false,false,false,false);
  var newRow = spreadsheet.getLastRow() + 1;
  var range = spreadsheet.getRange("A" + newRow);
  //Add New Row Data Visualizer
  range.setBorder(true, true, true, true, false, false, "blue", SpreadsheetApp.BorderStyle.SOLID);

  return range;//Get the next range to use
}

This sample is designed to move a "data visualizer" (alternative for set current cell) down the sheet. It clears the border of the last cell in column A, then adds a new row below it with blue borders on all sides, mimicking the setCurrentCell. The returned range allows for potential future actions on this new cell.

Demo:

  • Thank you, @Denise for sharing nice ideas! It is nice add-on, I put it in my code but it doesn't solve the problem -- scrolling 1000 rows with smartphone. – Nebobrod Aug 31 '23 at 13:32
  • This is result at desktop webapp: [link](https://imgur.com/a/aDGj6zk) And this is from mobile app: [link](https://imgur.com/uMPYd5m) – Nebobrod Aug 31 '23 at 13:52