在特定时间在其他单元格中自动锁定/保护Google表格中的行/单元格 [英] Automatic Lock/Protect Rows/cells in Google Sheets at a specific time in other Cells

查看:172
本文介绍了在特定时间在其他单元格中自动锁定/保护Google表格中的行/单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对Google表格单元格进行编码,以使某些单元格在特定时间自动锁定在另一个单元格中.我应该可以编辑它,但是我的协作者不能.

I want to code my Google Sheets cells in a way that certain cells automatically lock at a specific time in another cell. I should be able to edit it, but not my collaborators.

我如何做到这一点?

文件样本链接

在样本表1中,如果行单元格D:D> 120,则行E受到保护. 例如:在文件C 9> 120上,然后对E 9进行保护.

In the sample sheet 1, If row cell D:D > 120 then cell row E protect. example: on file C 9 > 120 then E 9 protected.

推荐答案

基于此

Based from this forum, you would need all the email address of your collaborators if you are trying to restrict others from editing their own input or if you want them blocked from editing your own. But then this script would also be locking their input into a cell after they do.

function onEdit(e) { 
 var active =  SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet Name").getActiveCell();
 active.protect().removeEditor("other editors emails");
  if(active.getColumn() == 5) { // condition for column active 
     active.setNote("Locked");
   }
  }

注意:

getSheetByName("Sheet Name")-将限制此功能为 那张纸. active.setNote("Locked");-显示哪些单元格是 锁定.

getSheetByName("Sheet Name") - would be to limit this function to that sheet. active.setNote("Locked"); - to display which cells are locked.

这篇关于在特定时间在其他单元格中自动锁定/保护Google表格中的行/单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆