0
votes

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?

1
Execution transcripts are automatically cleared after a set time or after next runTheMaster
@TheMaster, thanks for the input and sorry my question wasn't so clear. What I meant to ask was if it's possible to manually reset the execution transcript once the script has ran, without having to wait for the next run or a pre-defined amount of time.Luís Ramalho
AFAIK, No......TheMaster

1 Answers

1
votes

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