i have a sheet that contains 2000 rows of date and i want when open my sheet, open sheet in today date how can i do this ? I sent my picture of my sheet enter image description here
i've search in internet but not found any results
function gotodate() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Sheet0");
const dA = sh.getRange(2,1,sh.getLastRow() - 1,1).getDisplayValues().flat();
const dt = new Date();
const d = Utilities.formatDate(new Date(),Session.getScriptTimeZone(),"M/d/yyyy");
let idx = dA.indexOf(d)
if(~idx) {
sh.getRange(idx + 2,1).activate();
}
}
Demo:
Sheet0:
Date | HDR2 | HDR3 | HDR4 | HDR5 | HDR6 | HDR7 | HDR8 | HDR9 | HDR10 |
---|---|---|---|---|---|---|---|---|---|
6/29/2023 | 0 | 1 | 0 | 0 | 4 | 3 | 4 | 0 | 6 |
6/30/2023 | 1 | 1 | 3 | 3 | 1 | 4 | 4 | 7 | 8 |
7/1/2023 | 2 | 1 | 2 | 1 | 2 | 1 | 0 | 7 | 3 |
7/2/2023 | 3 | 1 | 0 | 4 | 6 | 2 | 7 | 10 | 9 |
7/3/2023 | 0 | 1 | 2 | 2 | 1 | 5 | 10 | 10 | 6 |
7/4/2023 | 0 | 6 | 0 | 7 | 2 | 6 | 2 | 3 | 6 |
7/5/2023 | 3 | 7 | 5 | 5 | 10 | 2 | 0 | 5 | 4 |
7/6/2023 | 3 | 6 | 8 | 7 | 1 | 0 | 12 | 10 | 0 |
7/7/2023 | 0 | 2 | 8 | 1 | 6 | 8 | 7 | 13 | 4 |
7/8/2023 | 0 | 5 | 11 | 12 | 9 | 7 | 13 | 1 | 16 |
7/9/2023 | 6 | 8 | 11 | 1 | 6 | 2 | 8 | 6 | 12 |
7/10/2023 | 11 | 4 | 3 | 11 | 1 | 13 | 8 | 4 | 16 |
7/11/2023 | 2 | 0 | 6 | 10 | 11 | 17 | 18 | 19 | 6 |
7/12/2023 | 6 | 2 | 4 | 0 | 2 | 1 | 6 | 0 | 11 |
7/13/2023 | 4 | 6 | 15 | 6 | 13 | 10 | 5 | 2 | 14 |
7/14/2023 | 8 | 12 | 1 | 14 | 1 | 2 | 16 | 17 | 6 |
7/15/2023 | 8 | 7 | 9 | 6 | 19 | 13 | 8 | 9 | 17 |
7/16/2023 | 7 | 18 | 12 | 13 | 18 | 14 | 15 | 0 | 21 |
7/17/2023 | 5 | 16 | 8 | 3 | 22 | 0 | 17 | 22 | 0 |
7/18/2023 | 6 | 18 | 10 | 3 | 8 | 7 | 1 | 24 | 11 |
7/19/2023 | 4 | 14 | 18 | 18 | 15 | 25 | 6 | 24 | 0 |
7/20/2023 | 8 | 11 | 4 | 14 | 15 | 1 | 26 | 1 | 29 |
7/21/2023 | 9 | 21 | 20 | 1 | 24 | 16 | 21 | 26 | 17 |
7/22/2023 | 21 | 15 | 16 | 10 | 24 | 16 | 5 | 28 | 9 |
7/23/2023 | 1 | 2 | 10 | 15 | 9 | 7 | 21 | 19 | 32 |
7/24/2023 | 18 | 1 | 0 | 6 | 18 | 16 | 28 | 26 | 19 |
7/25/2023 | 10 | 0 | 25 | 22 | 30 | 0 | 3 | 31 | 6 |
7/26/2023 | 19 | 0 | 24 | 1 | 31 | 22 | 33 | 4 | 8 |
7/27/2023 | 2 | 20 | 5 | 6 | 5 | 5 | 20 | 32 | 1 |
7/28/2023 | 14 | 25 | 10 | 32 | 15 | 20 | 33 | 22 | 8 |
7/29/2023 | 0 | 28 | 7 | 24 | 19 | 19 | 10 | 34 | 28 |
7/30/2023 | 5 | 9 | 31 | 32 | 5 | 12 | 19 | 9 | 23 |
7/31/2023 | 23 | 32 | 20 | 13 | 32 | 30 | 31 | 29 | 16 |
8/1/2023 | 2 | 31 | 27 | 5 | 8 | 34 | 2 | 22 | 24 |
8/2/2023 | 19 | 28 | 16 | 28 | 36 | 38 | 27 | 9 | 25 |
8/3/2023 | 31 | 30 | 21 | 32 | 38 | 20 | 5 | 38 | 0 |
8/4/2023 | 19 | 26 | 23 | 15 | 24 | 20 | 9 | 4 | 20 |
8/5/2023 | 1 | 30 | 13 | 39 | 33 | 24 | 7 | 25 | 39 |
8/6/2023 | 15 | 3 | 31 | 5 | 21 | 41 | 35 | 43 | 25 |
8/7/2023 | 34 | 32 | 10 | 24 | 15 | 30 | 3 | 42 | 40 |
8/8/2023 | 8 | 26 | 39 | 16 | 11 | 20 | 19 | 28 | 35 |
8/9/2023 | 37 | 14 | 16 | 17 | 8 | 28 | 43 | 14 | 15 |
8/10/2023 | 30 | 21 | 8 | 26 | 2 | 19 | 37 | 37 | 37 |
8/11/2023 | 23 | 4 | 22 | 18 | 42 | 26 | 35 | 37 | 3 |
8/12/2023 | 26 | 43 | 25 | 40 | 38 | 42 | 7 | 32 | 37 |
8/13/2023 | 18 | 6 | 8 | 27 | 37 | 31 | 8 | 25 | 8 |
8/14/2023 | 43 | 27 | 40 | 32 | 48 | 14 | 23 | 48 | 3 |
8/15/2023 | 2 | 42 | 38 | 49 | 24 | 15 | 36 | 8 | 21 |
8/16/2023 | 12 | 15 | 47 | 42 | 45 | 13 | 26 | 10 | 3 |
8/17/2023 | 34 | 22 | 22 | 18 | 46 | 4 | 7 | 26 | 43 |
8/18/2023 | 22 | 13 | 12 | 49 | 39 | 55 | 11 | 24 | 3 |
8/19/2023 | 35 | 47 | 32 | 23 | 18 | 26 | 15 | 40 | 53 |