Script to scroll down and up

1,072 views
Skip to first unread message

Karl Sorokovsky

unread,
Sep 2, 2020, 3:41:38 PM9/2/20
to google-apps-sc...@googlegroups.com
I have spread sheet with 153 rows. Have this sheet with information filled up and displaying it on tv thru shareable browser link. Idea is to make a loop which will scroll down to the bottom and scroll it back to the top in endless loop. I could do it with macro on pc, but that is not an option for me. Will be happy to get any help on this. Thank you!

Karl Sorokovsky

unread,
Sep 2, 2020, 3:53:00 PM9/2/20
to Google Apps Script Community
Something like moving focus from 1 cell to other cell with delay 5 sec would work. Like focus A4, delay 5 seconds and put focus on A 5, another delay 5 sec and again focusing on A6. We reached focus An we getting backward. Just don't understand how to move focus on user's part.
Message has been deleted

Jean-Luc Vanhulst

unread,
Sep 2, 2020, 4:56:47 PM9/2/20
to google-apps-sc...@googlegroups.com
There's a limit on how long a script can run. So you need to use Utilities.sleep()

But that will not make it in a forever running slideshow.

Jean-Luc Vanhulst - President - Write2market.com
Cell: 347-453-7686




On Wed, Sep 2, 2020 at 4:52 PM Karl Sorokovsky <Karl.vl...@gmail.com> wrote:
function PageDown() {
  var spreadsheet = SpreadsheetApp.getActive();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var MAIN = ss.getSheetByName("MAIN");

  var j = MAIN.getMaxRows();
  
  for(var i = 0; i<j; i+=15){
  
  spreadsheet.getRange('A4:A18' + i).activate();
  sleep(5000);
  
  }
  
  
};
This is where I got to so far, but have an Error:"ReferenceError: sleep is not defined"



On Wednesday, September 2, 2020 at 2:41:38 PM UTC-5, Karl Sorokovsky wrote:
I have spread sheet with 153 rows. Have this sheet with information filled up and displaying it on tv thru shareable browser link. Idea is to make a loop which will scroll down to the bottom and scroll it back to the top in endless loop. I could do it with macro on pc, but that is not an option for me. Will be happy to get any help on this. Thank you!

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/a2b2f145-1b16-4304-80c7-ac27d30e395do%40googlegroups.com.

Karl Sorokovsky

unread,
Sep 2, 2020, 5:03:16 PM9/2/20
to google-apps-sc...@googlegroups.com

Thank you for reply Jean, I deleted post before saw your reply, luckily I have email notifications.
I think that I'm making mistake here "spreadsheet.getRange('A4:A18' + i).activate();" trying to add 15 at each stem to range A4:A18, so next step is A19:A33. any chance you could help me there?
/** @OnlyCurrentDoc */

function PageDown() {
  var spreadsheet = SpreadsheetApp.getActive();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var MAIN = ss.getSheetByName("MAIN");

  var j = MAIN.getMaxRows();
  
  for(var i = 0; i<j; i+=15){
  
  spreadsheet.getRange('A4:A18' + i).activate();
  Utilities.sleep(500);
  
  }
  
  
};


Jean-Luc Vanhulst

unread,
Sep 2, 2020, 5:09:30 PM9/2/20
to google-apps-sc...@googlegroups.com
The bigger problem is that what you want to achieve (a shareable link to a 'viewer' that keeps scrolling through a spreadsheet) cannot be done like this because a Google Script cannot run more than something like 4 minutes. After that it will always stop.
On Wed, Sep 2, 2020 at 5:03 PM Karl Sorokovsky <Karl.vl...@gmail.com> wrote:

Thank you for reply Jean, I deleted post before saw your reply, luckily I have email notifications.
I think that I'm making mistake here "spreadsheet.getRange('A4:A18' + i).activate();" trying to add 15 at each stem to range A4:A18, so next step is A19:A33. any chance you could help me there?
On Wednesday, September 2, 2020 at 2:53:00 PM UTC-5, Karl Sorokovsky wrote:
Something like moving focus from 1 cell to other cell with delay 5 sec would work. Like focus A4, delay 5 seconds and put focus on A 5, another delay 5 sec and again focusing on A6. We reached focus An we getting backward. Just don't understand how to move focus on user's part.

On Wednesday, September 2, 2020 at 2:41:38 PM UTC-5, Karl Sorokovsky wrote:
I have spread sheet with 153 rows. Have this sheet with information filled up and displaying it on tv thru shareable browser link. Idea is to make a loop which will scroll down to the bottom and scroll it back to the top in endless loop. I could do it with macro on pc, but that is not an option for me. Will be happy to get any help on this. Thank you!

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Karl Sorokovsky

unread,
Sep 2, 2020, 5:14:49 PM9/2/20
to google-apps-sc...@googlegroups.com
Have a TV which runs 24/7 and there is a spreadsheet open. I can't fit the whole sheet there for visibility, my idea was to make it scroll down by itself and when it reaches bottom scroll back up.
Do you have any suggestions? 



--
Karl Sorokovsky
VL Trucking, Inc.

Karl Sorokovsky

unread,
Sep 2, 2020, 5:16:15 PM9/2/20
to Google Apps Script Community

Jean-Luc Vanhulst

unread,
Sep 2, 2020, 5:27:39 PM9/2/20
to google-apps-sc...@googlegroups.com
Probably easiest is to go with a Chrome plugin that does a slide show and as the 'slides' use different URL's into the spreadsheet?

If you right click on a cell somewhere halfway your spreadsheet and then choose "Get a Link to this Cell" you get a URL that will bring up the spreadsheet in that spot:
image.png

repeat for two or three more (or however many pages you have) times and then add those URLS in the 'slide show' and you're in business? 

On Wed, Sep 2, 2020 at 5:16 PM Karl Sorokovsky <Karl.vl...@gmail.com> wrote:
Have a TV which runs 24/7 and there is a spreadsheet open. I can't fit the whole sheet there for visibility, my idea was to make it scroll down by itself and when it reaches bottom scroll back up.
Do you have any suggestions? 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Karl Sorokovsky

unread,
Sep 2, 2020, 5:33:02 PM9/2/20
to Google Apps Script Community
Will do! Thank you so much for your help!!!


On Wednesday, September 2, 2020 at 4:27:39 PM UTC-5, Jean-Luc Vanhulst wrote:
Probably easiest is to go with a Chrome plugin that does a slide show and as the 'slides' use different URL's into the spreadsheet?

If you right click on a cell somewhere halfway your spreadsheet and then choose "Get a Link to this Cell" you get a URL that will bring up the spreadsheet in that spot:
image.png

repeat for two or three more (or however many pages you have) times and then add those URLS in the 'slide show' and you're in business? 


On Wed, Sep 2, 2020 at 5:16 PM Karl Sorokovsky <Karl.vl...@gmail.com> wrote:
Have a TV which runs 24/7 and there is a spreadsheet open. I can't fit the whole sheet there for visibility, my idea was to make it scroll down by itself and when it reaches bottom scroll back up.
Do you have any suggestions? 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages