0

I want people to jump to the current date row when opening the sheet. However, this should be the case for everyone viewing the sheet and irrespective of their edit-rights. For example, I want that people edit the current date row in the sheet every day over the link. In this case, onOpen() does not work. Is there any alternative or modification to the function?

I am informed about onOpen trigger, however, this would not work if somebody is editing the sheet only over the link with edit rights.

This is e.g. the code I would like to work for everyone:

function onOpen() {
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var sheet = ss.getActiveSheet();
 var range = sheet.getRange("B:B");
 var values = range.getValues();  
 var day = 24*3600*1000;  
 var today = parseInt((new Date().setHours(0,0,0,0))/day);  
 var ssdate; 
 for (var i=0; i<values.length; i++) {
   try {
     ssdate = values[i][0].getTime()/day;
   }
   catch(e) {
   }
   if (ssdate && Math.floor(ssdate) == today) {
     sheet.setActiveRange(range.offset(i,0,1,1));
     break;
   }    
 }
}
player0
  • 124,011
  • 12
  • 67
  • 124

1 Answers1

0

I found the options: Edit Triggers

To manually create an installable trigger through a dialog in the script editor, follow these steps:

From the script editor, choose Edit > Current project's triggers.

Click the link that says: No triggers set up. Click here to add one now.

Under Run, select the name of function you want to trigger.

Under Events, select either Time-driven or the Google App that the script is bound to (for example, From spreadsheet).

Select and configure the type of trigger you want to create (for example, an Hour timer that runs Every hour or an On open trigger).

Optionally, click Notifications to configure how and when you are contacted by email if your triggered function fails.

Click Save.

Google Explanation to Edit Triggers

  • So, did that solve your issue? If that's the case, you can accept your answer and mark the question as solved. – Iamblichus Oct 02 '19 at 07:20