Страницы: 1
RSS
Блокировка редактирования ячеек в Гугл Таблице.
 
Всем привет! У меня стоит задача, написать макрос который будет блокировать определенные ячейки в Гугл таблице после определенного времени. Например каждый день с 16:00 до 23:00 будут блокировать ячейки, а после 23:00 редактирование будет разрешено.
 
Цитата
Maksim090 написал:
У меня стоит задача
Спасибо что сообщили нам об этом .Когда решите задачу, также сообщите нам.
По вопросам из тем форума, личку не читаю.
 
Бинг предложил такой скрипт
Код
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.  
Goedenavond!
Страницы: 1
Наверх