/docs/community?hl=en
/docs/community?hl=en
7/19/15
Original Poster
marahsorris

How do I get my google spreadsheet to autoscroll to the row containing today's date?

I have a column that contains each day of the month except saturday and sunday. When I open the spreadsheet, I want it to automatically go to the cell with today's date in it. This spreadsheet is embedded online, so I hope that the version online will also automatically go to the cell with today's date in it. 
Community content may not be verified or up-to-date. Learn more.
All Replies (4)
Torre G
7/19/15
Torre G
Hi 

I think you need a script 

Please take a look at these posts ....



Cheers
Torre
7/19/15
Original Poster
marahsorris
Thank you for your reply. I had seen both of those posts when googling for an answer. I don't know how to create? Run? Apply? A script. Can you offer any advice there?
GimelG
7/19/15
GimelG
Hi marahsorris,

Here is one way to do this:

function onOpen() {
  var ss, sheet, dates, today, dateArray;
  ss = SpreadsheetApp.getActiveSpreadsheet();
  sheet = ss.getSheetByName('Sheet1');
  dates = sheet.getRange('a2:a').getValues();
  today = new Date();
  dateArray = [];
  
  for (var i = 0, length = dates.length; i < length; i++)
  {
    dateArray.push(dates[i][0]);
    if (dateArray[i] > today) {break};
  }
  sheet.getRange(dateArray.length, 1).activate();
}

This script will look at the column of dates starting at A2 (assuming there is a header) in Sheet1, find the first date that is bigger (later) than today, and select the cell with the date prior to it. This means that on weekdays it will select today's date; on weekends, due to the fact that you skip them, it will select the last Friday. If the sheet name is not 'Sheet1', adjust the orange bit accordingly. If the column of dates is not A, adjust the yellow bit accordingly.

1) Open Tools -> Script editor... A new tab will open, delete what's in there and paste this script. 
2) Click File -> Save. 
3) Click Run -> onOpen. It will prompt you for authorization; click Continue and then Accept. 
4) You can now close the script editor tab. The script will work every time you open or refresh the spreadsheet.

Does that work?

Cheers,
G
Were these replies helpful?
How can we improve them?
 
This question is locked and replying has been disabled. Still have questions? Ask the Help Community.

Badges

Some community members might have badges that indicate their identity or level of participation in a community.

 
Expert - Google Employee — Googler guides and community managers
 
Expert - Community Specialist — Google partners who share their expertise
 
Expert - Gold — Trusted members who are knowledgeable and active contributors
 
Expert - Platinum — Seasoned members who contribute beyond providing help through mentoring, creating content, and more
 
Expert - Alumni — Past members who are no longer active, but were previously recognized for their helpfulness
 
Expert - Silver — New members who are developing their product knowledge
Community content may not be verified or up-to-date. Learn more.

Levels

Member levels indicate a user's level of participation in a forum. The greater the participation, the higher the level. Everyone starts at level 1 and can rise to level 10. These activities can increase your level in a forum:

  • Post an answer.
  • Having your answer selected as the best answer.
  • Having your post rated as helpful.
  • Vote up a post.
  • Correctly mark a topic or post as abuse.

Having a post marked and removed as abuse will slow a user's advance in levels.

View profile in forum?

To view this member's profile, you need to leave the current Help page.

Report abuse in forum?

This comment originated in the Google Product Forum. To report abuse, you need to leave the current Help page.

Reply in forum?

This comment originated in the Google Product Forum. To reply, you need to leave the current Help page.