Is it possible to disable or reset the Execution Transcript in Google Apps Script?
If not, what would be the best way to run a script that requires sensitive access tokens for API calls?
Use a time-based trigger to invoke a simple dummy script:
function clearIt() {
Logger.log("hi");
}
This script could be invoked every minute, or specifically invoked via one-time trigger to occur after specific other functions. If you go the one-time route you'll need to delete the invoking trigger to avoid accumulation:
function sensitive() {
...
ScriptApp.newTrigger("newExecutionTranscript")
.timeBased().after(1) // runs at up to 15m later
.create();
}
function newExecutionTranscript(e) {
const invoker = (!e) ? null : ScriptApp.getProjectTriggers()
.filter(function (t) {
return t.getUniqueId() === e.triggerUid;
})[0];
if (invoker)
ScriptApp.deleteTrigger(invoker);
Logger.log("Done");
}
References