[英]Disable Script authorization when logging sheet username in Google Sheets within my G suite domain
I am creating a daily task list in Google Sheets for my employees to work off of. 我正在Google表格中创建每日任务列表,以供员工使用。 I am domain admin. 我是域管理员。
Each checklist item logs the time and username in Column Z when row changes (item is checked off). 当行更改时(项目被选中),每个清单项目将时间和用户名记录在Z列中。 This tracks when the daily task was done, and by whom. 这会跟踪日常任务的执行时间以及由谁执行。
Eg "Check voicemail" "Check faxes" 例如,“检查语音邮件”,“检查传真”
-- When user puts a checkmark in one of these items, I want their email address or domain username and a time stamp to show up in Column Z. -当用户在其中一项中打勾时,我希望他们的电子邮件地址或域用户名以及时间戳显示在Z列中。
PROBLEM: There will be a new copy of this sheet for each day. 问题:每天都会有此表的新副本。 The script has to be authorized for each individual user on each day (new sheet) for the script to work properly. 必须每天(每个新工作表)为每个用户授权脚本,脚本才能正常工作。
COMPLICATING FACTOR: I need to keep my domain HIPAA compliant so I am leery of enabling App Marketplace for my domain. 复杂因素:我需要保持我的域HIPAA的合规性,因此我乐于为我的域启用App Marketplace。
NEEDED SOLUTION: As domain admin, how do I make the script authorized to be used on my domain? 所需的解决方案:作为域管理员,如何使脚本授权在我的域上使用? Once it is authorized, how do I link it to the master sheet and daily copies of the sheet Allow this script on my domain to capture domain usernames without individual authorization. 获得授权后,如何将其链接到主表和工作表的日常副本允许我的域上的此脚本无需单独授权即可捕获域用户名。
THANKS! 谢谢!
function onEdit(event) { var now2 = Utilities.formatDate(new Date(), "EST", "E MMM dd, yyyy @ hh:mm a"); SpreadsheetApp.getActiveSheet().getRange("Z1").setValue("Sheet Last Modified: " +now2); var s = SpreadsheetApp.getActiveSheet(); var r = s.getActiveCell(); if( r.getColumn() != 6 ) { //checks the column var row = r.getRow(); var time2 = new Date(); var user = Session.getEffectiveUser(); time = Utilities.formatDate(new Date(), "EST", "E MMM dd, yyyy @ hh:mm a"); time2 = Utilities.formatDate(new Date(), "EST", "E MMM dd, yyyy"); SpreadsheetApp.getActiveSheet().getRange('Z' + row.toString()).setValue(time+" by: "+user); SpreadsheetApp.getActiveSheet().getRange("Z2").setValue("Row Last Modified"); }; };
I figured out how to NOT ask for authorization within my domain. 我想出了如何在我的域内不请求授权。 I had to run as an installable trigger. 我必须作为可安装的触发器运行。
In the Google Script.. Go to Edit menu, and hit "Current Project's Triggers" 在Google脚本中。转到“编辑”菜单,然后点击“当前项目的触发器”
Then, install an on Edit Trigger... 然后,在编辑触发器上安装...
This no longer asks for authorization! 这不再要求授权!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.