Click here to Skip to main content
14,356,442 members
Rate this:
Please Sign up or sign in to vote.
I have a table in Google Sheets in the format:


Date supply demand

Date2 supply demand


Others are required to fill in inventory and demand every day. However, they should only fill out demand and inventory of the current day. They are also not allowed to change previous data or in advance fill in future days inventory and demand. Therefore, I want to protect the whole sheet from being edited by others, except the row with the current date. For example today (23.09) they should be able to edit the row where B is 23.09.2019 and nothing else. 

This works perfectly find on desktop. I will post my current code below. However, I do not know how to get the code running in the iOS and Android Google Sheets App, because some survey participants will use mobile instead of desktop. Here is my current sheet:

What I have tried:

My current code in the script editor: 

only be able to edit current date

function myFunction() {
 var sheet=SpreadsheetApp.getActive().getActiveSheet();
 var range=sheet.getDataRange();
 var values=range.getValues();
 var today=new Date();
 var todayMs=today.getTime();
  for(var i=5;i

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100