简体   繁体   中英

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. I am domain admin.

Each checklist item logs the time and username in Column Z when row changes (item is checked off). 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.

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.

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"

Then, install an on Edit Trigger...

This no longer asks for authorization!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM