Process

Leveraging GCP for Seamless Google Apps Script Log Export and Analysis with Gemini API

Gists

Abstract

Linking a Google Apps Script project to a GCP project enables you to export logs from the Class console to Logs Explorer for simplified analysis and debugging. By overcoming the limitations of in-script logging methods, this report outlines a method for exporting logs using the Cloud Logging API with Google Apps Script.

Introduction

While developing applications with Google Apps Script, the Class console is a valuable tool for debugging individual components. Ref However, a key limitation exists: by default, Google Apps Script projects on Google Drive are not linked to Google Cloud Platform (GCP) projects. In this unlinked scenario, logs from the Class console are only visible within the script editor, requiring manual copying for export.

GAS Library - ProcessApp

Overview

This is a library for retrieving the process and information of Google Apps Script.

Methods

  1. getExecutionTimeOfTrigger() : This method retrieves the total execution time of all functions executed by the time-driven trigger at owner’s account. For example, you can know the total execution time of all functions executed by the time-driven trigger in 24 h.
  2. getDevUrl() : This method retrieves the endpoint of developer mode for Web Apps like https://script.google.com/macros/s/#####/dev.
  3. getRunningFunctions() : This method retrieves the functions which are running now.

You can check this at https://github.com/tanaikech/ProcessApp.