Бинг предложил такой скрипт
Код |
---|
function lockCells() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("table"); // get the sheet by name
var range = sheet.getRange("A1:B10"); // get the range of cells you want to protect
var protection = range.protect().setDescription("Locked cells"); // protect the range and add a description
protection.removeEditors(protection.getEditors()); // remove all editors except yourself
} |
Но говорит, что в сам скрипт нельзя вставить такую функцию ограничения по времени, а можно в настройках поставить такое
Hier ist die Übersetzung deines Textes auf Englisch:
No, this macro will always lock the cells when you run it. To run it only at a specific time, you need to create a time-driven trigger. You can do this as follows:
- Click on Edit > Triggers for current project in the script editor.
- Click on Add trigger in the lower right corner.
- Select the function you want to run, in this case lockCells.
- Select the event type, in this case Time-driven.
- Select the time period in which you want to run the macro, in this case Hour timer.
- Select the exact time at which you want to run the macro, in this case 16:00 to 17:00.
- Click on Save.
Now your macro will run every day between 16:00 and 17:00 and lock the cells. If you want to run the macro at a different time, you can change or delete the trigger. I hope this is clearer.