AppsScriptPulse

Celebrating 15 years of Apps Script 🎉 🥂

Today is a special milestone for Google Apps Script, as it marks its 15th year anniversary of its release back on August 19th, 2009! 🎉 🥂Since its release back in the day when Google Workspace was still known as Google Apps, Apps Script has been regularly leveraged by literally millions of users ranging from standard end users to professional developers and everything in between to automate and customize solutions to make their work (and play) better. 👩‍💻

To note the occasion, Google Technical Writer (and renown Apps Script expert & biggest fan 😍) Kara Ireland and I [Charles Maxson] put out a little YouTube Short video that we’d love to get trending to let folks see how Apps Script is still appreciated after all those years, so give it a ‘like’ and share it along if you will please 🙂

It’s that time of year again when we celebrate the launch of Google Apps Script. As well as this YouTube short from Kara Ireland and Charles Maxson there is an accompanying LinkedIn post worth checking out, particularly the comments section which has attracted responses from the great and the good, as well as some Apps Script ‘archive’ materials.

In my early days of Apps Scripting I would often be asked, would the product survive. In many ways not only has Apps Script survived but in many ways thrived. That’s not to say it’s the perfect product. There are a number of areas where I’m sure myself and others would like to see Apps Script developed.

However, I still see many positive signs that Apps Script will be supported as a product. The advent of GenAI solutions like Gemini for Workspace have opened Apps Script up to a whole new audience, not only to people who are ‘gen creators’ and able to create script solutions mainly by prompts, but also developments in GenAI solutions to write and execute code.

So Happy Birthday Apps Script and here’s to many more!

Source: Charles Maxson – LinkedIn Post

Google Workspace Developer Preview Program: New Card UI in Chat

You can apply to join the Google Workspace Developer Preview Program to get early access to certain features. Features in developer preview have already completed early development phases, so they’re ready for implementation. This program gives you the chance to shape the final stages of feature development with feedback, get pre-release support, and have your integration ready for public use on launch day.

The Google Workspace Developer Preview Program (DPP) gives you early access to new features. If you are developing Google Workspace products and solutions, it’s a great way to stay ahead of the curve and provide feedback before feature release. Anyone can apply to join the DPP, just follow the source link, but note that you can’t enroll with a gmail.com account.

New Google Chart Card UI has just been added for buttons, chips, collapsible sections, and overflow menus. These additions extend the capability of Google Chat, allowing the possibility for users to interact with external tools and services without leaving the chat and continually having to context switch.

The public documentation page includes a list of all active developer previews. While these pages don’t offer visuals of the features, existing DPP members received a nice set of visuals in the email update. This example includes chips and a customizable control button for a collapsible section:

I’d highly recommend registering for the DPP so you can see what is coming in Google Workspace.

Source: Developer Preview Program  |  Google Workspace  |  Google for Developers

UtlApp: A Versatile Google Apps Script Library for array, binary, and string processing

This is a Google Apps Script library including useful scripts for supporting to development of applications by Google Apps Script. In the current stage, the 3 categories “For array processing”, “For binary processing”, and “For string processing” are included in this library.

Google Apps Script developers often find themselves grappling with repetitive tasks particularly when handling Google Sheets data like array manipulation and A1 notation handling. Fortunately, this little versatile library from Kanshi Tanaike called UtlApp is here to help you simplify many of these common challenges.

Array Processing Made Easy

UtlApp includes a number of powerful array processing methods that can significantly streamline your code. Need to rearrange your data? The transpose method makes it effortless to flip your rows and columns. Want to extract specific data points? getSpecificColumns allows you to pinpoint and retrieve the exact columns you need. Dealing with large datasets? Quickly identify the first empty row or column using get1stEmptyRow and get1stEmptyColumn. And when it’s time to convert your array data into a more structured format, convArrayToObject can transform it into a JSON object, ready for further manipulation or integration.

Simplifying String Processing

UtlApp helps with common string processing tasks specifically for Google Sheets users. With columnLetterToIndex and columnIndexToLetter, you can convert between column letters and indices, making it simpler to work with spreadsheet data. UtlApp also offers convenient methods for managing A1Notations, such as consolidating scattered ranges using consolidateA1Notations or expanding them with expandA1Notations.

Handling Binary Data

UtlApp doesn’t stop at arrays and strings; it can also handle Blobs with the blobToDataUrl method. This function can convert Blob data into a convenient data URL format, making it suitable for embedding images or other binary content directly within HTML or CSS. This simplifies the process of working with Blobs in web-based Google Apps Script applications.

Effortless Integration

Adding UtlApp to your Google Apps Script project is a breeze! You have three convenient options: add the library directly using its project key, copy the individual script source files for array, binary, and string processing or copy individual functions  into your project.

To find out more follow the source link to the GitHub repository.

Source: GitHub – tanaikech/UtlApp

Using Google Forms and the Gemini API to automate creation of multiple choice questions (MCQs)

This report proposes a novel learning method using Gemini to automate Q&A generation, addressing the challenges of manual Q&A creation. By integrating with Google tools, this approach aims to enhance learning efficiency, accessibility, and personalization while reducing costs.

The rapid advancement of technology has offered both opportunities and challenges to the education sector. While technology can be a valuable tool for supporting teaching and learning, concerns about its appropriate use have existed for a long time.

The education sector is witnessing an increase in AI tools, each promising to enhance teaching and learning. However, the quality of these tools varies significantly. Some are better designed and can – if used appropriately – can be beneficial, while others are poorly designed. This can make it challenging for educators to find the right solutions that meet their specific needs.

This blog post by Kanshi Tanaike sheds light on the inner workings of some commercial AI tools developed for educators. It demonstrates how these tools can use generative AI to create multiple-choice questions (MCQs) on a given topic. In this particular solution, Google Forms are used in the process, with questions and answers automatically generated by the Gemini API for the user to answer in a Google Form.

For educators who have experience with Google Apps Script, this project looks like a useful starting point to refine and create your own solution or simply used to gain insights into the functioning of similar commercial tools.

Source: A Novel Approach to Learning: Combining Gemini with Google Apps Script for Automated Q&A

Google Workspace Developer News: Updates to Tasks API, Chat API, new allowlist feature for Apps Scripts, and more


I’m continually blown away by how much information Google Developer Advocate Chanel Greco squeezes into the Google Workspace Developer News video updates. It’s also great to see the continued development of features and services Workspace developers can use. This video covers a number of updates including:

  • Using the Tasks API to manage tasks assigned from Google Docs or Chat spaces.
  • The general availability of multiselect menus and columns for Google Workspace Add-ons.
  • Using the Chat API to make a Google Chat space discoverable to specific users within an organization by creating target audiences.
  • Authenticating Chat app requests using Cloud Functions, Cloud Run, or an App URL ID Token.
  • Importing spaces from other messaging platforms and allowing external users to join them.
  • The Google Drive API now supports the drive.meet.readonly scope.
  • Google Workspace admins can restrict which URLs Apps Scripts and Sheets can source external content from.

The video description includes all the related documentation links to find out more.

Source: Updates to Tasks API, Chat API, new allowlist feature for Apps Scripts, and more

Exporting high-resolution PNG images of Google Slides with Google Apps Script

Learn how to convert Google Slides into high-resolution PNG images using Google Apps Script. Choose between the Google Slides API and the Google Drive API based on your requirements.

Here’s a useful snippet from Amit Agarwal exploring two methods exploring how to convert Google Slides to PNG images with Google Apps Script. The first approach uses the Google Slides API to get the thumbnail images of the slides, fetch the blob of the image, and then upload it to Google Drive. However, this method has limitations including predefined fixed widths and requires two URL fetches.

The second approach uses the Google Drive API, which offers advantages like generating images with the same resolution as the original slide and requiring a single URL fetch. For both code snippets follow the source link.

Source: How to Convert Google Slides to PNG Images with Google Script – Digital Inspiration

Collaborative Apps Script Development with GenAI code assistance in Google Project IDX

Project IDX allows you to use all your favourite IDE extensions and themes, but also offers AI assistance through tools like Gemini Code Assist. It also has one-click integration to many Google products such as Firebase Hosting or deploying your app to Cloud Run. A really handy feature of IDX is the ability to share a workspace with a colleague so you can collaborate and develop together in real time! …

This guide will demonstrate how to develop your Apps script code from within Project IDX, and we will even touch on how to enable Google’s AI Code Assistant to get extra help when writing your App scripts.

The current Apps Script integrated development environment (IDE) has several limitations that can hinder collaboration and productivity. One significant limitation is the lack of real-time collaboration. Multiple users cannot simultaneously edit the same script, making it challenging for teams to work together on projects. This can lead to version control issues and conflicts, especially when multiple developers are making changes concurrently.

Project IDX is an experimental cloud-based IDE developed by Google. IDX is designed to make it easier to create, edit and deploy applications eliminating the tasks of configuring development environments for yourself and your team. For Google Workspace developers already doing local code development using VS Code the interface will be familiar as IDX is also built on Code OSS.

As well as being cloud-based IDX has some useful features built-in including GitHub import, extension and a Gemini code assistant. In addition to real-time collaboration (still highly experimental), IDX features a Gemini-powered code assistant with both a suggestion tool and a sidebar chat agent for code where you can discuss your code and get additional help.

This guide by Josh McMurdo demonstrates how you can set up IDX to develop Google Apps Script projects, including the installation of the clasp command line tool to push/pull code to Apps Script projects. As IDX is able to import existing GitHub repositories if you’ve not done local Apps Script development before I recommend Amit Agarwal’s Google Apps Script Starter kit, which can be cloned in IDX from https://github.com/labnol/apps-script-starter.

Once cloned IDX will automatically run the npm install to add all the dependencies. To switch to your own GitHub repository, create a new repo then in the terminal run the following command replacing YOUR_ACCOUNT and YOUR_REPO:

git remote set-url origin https://github.com/YOUR_ACCOUNT/YOUR_REPO.git

One other note on Josh’s post you don’t need the Add Gemini API step. IDX comes with Gemini code assist enabled, the Add Gemini API step is only required if you want to use Gemini in your Apps Script solution.

A reminder that Google states “Project IDX is in beta. Project IDX is likely to change and is not subject to any service level agreement (SLA) or deprecation policy. The implementation is subject to change without notice and in future releases. Use caution before proceeding to use IDX in a production environment.” IDX also can’t run Apps Script code so you’ll need to use clasp to push back into your Apps Script project and debug there.

Follow the link to Josh’s post to read more…

Source: Using Project IDX to write Google Apps Script

Gassypedia – Apps Script developer ecosystem over time

Gassypedia is a bigquery datatset and Google Looker report for analyzing on the Google Apps Script developer ecosystem on Github

The Apps Script developer ecosystem is an exciting and growing space. Bruce McPherson recently published a blog post that analyzes trends in this ecosystem using publicly available GitHub data which has been added to a BigQuery dataset.

Key findings of the post include that the number of Apps Script repositories and developers on GitHub is on the rise. There is a wide variety of Apps Script projects, including add-ons, web apps, and LookerStudio connectors. The report highlights popular OAuth scopes, advanced services, and libraries utilised by developers. It also offers insights into the geographical distribution of developers and the prevalence of tools like clasp.

Bruce acknowledges that the data is limited to public GitHub repositories, which may not be fully representative of the entire Apps Script ecosystem, but it’s nevertheless a great jumping off point if you are interested in exploring Apps Script solutions. You can access the full report via the source link.

Source: Gassypedia – Apps Script developer ecosystem over time – Desktop liberation

Using Google Drive API and Google Apps Script to convert between Google Docs and Markdown

Great news for fans of both Google Docs and Markdown! Google Docs recently acquired the ability to export documents directly into the markdown format.

This functionality extends beyond the user interface, with early indications suggesting the Google Drive API might also be capable of converting between Google Docs and Markdown. I confirmed that this could also be achieved by Drive API. This opens exciting possibilities for automated workflows.

Google recently announced in July 2024 that import and export Markdown in Google Docs. This is a user facing features, which Google announced includes the ability to:

  • Convert Markdown to Docs content on paste
  • Copy Docs content as Markdown
  • Export a Doc as Markdown (from File > Download)
  • Import Markdown as a Doc (from File > Open or “Open with Google Docs” from Drive)

Kanshi Tanaike hasn’t wasted any time in unpicking Markdown conversion capabilities using the Google Drive API. This functionality enables automated workflows for converting between Google Docs and Markdown. There are various scenarios where this can be useful, in particular, given GenAI solutions like the Gemini API often generate markdown there are opportunities to automatically convert these to Google Docs.

As part of the source post there are sample scripts: one for converting Google Docs to Markdown and another for converting Markdown to Google Docs.

For the Markdown to Google Docs it is assumed that there is already a Markdown file in Google Drive. If you have a Markdown text as a string, for example from a Gemini API response, then you can create a formatted Google Doc using the following snippet designed to be used with v3 of the Google Drive Advanced Service:

function sample3() {
  // note string is tab sensitive (tabs are converted to code blocks on certain Workspace accounts)
  const sampleText = `sample text 1

| a1 | b1 | c1 |
| :---- | :---- | :---- |
| a2 | b2 | c2 |

sample text 2

* sample option1
* sample option2
* sample option3

sample text 3`;

  const blob = Utilities.newBlob(sampleText, 'text/markdown');
  const fileMetadata = {
    name: `Sample MD Conversion`,
    mimeType: MimeType.GOOGLE_DOCS,
  };

  Drive.Files.create(fileMetadata, blob, { supportsAllDrives: true });
}

Source: Convert Google Document to Markdown and vice versa using Google Apps Script

Harnessing the power of Puppeteer, Cloud Run, and GraphQL with Google Apps Script

A Google Cloud run hosted puppeteer with a graphQL interface … In this article I’ll show you how to use this (I’ve called it gql-puppet ) with Apps Script

One of Apps Scripts superpowers is the ability to make HTTP requests to external services. These can be requests to other product APIs, or as in the following example, your own services. In this post from Bruce Mcpherson you can learn how you can use Google Apps Script to interact with a service he has created on Cloud Run which has a deployment of the headless browser, Puppeteer.

To interact with Puppeteer, Bruce has added GraphQL as an application interface. GraphQL is a query language that allows developers to request specific data from an API, making it more efficient and flexible than REST, which often requires multiple requests to retrieve the same data.

As Puppeteer is just a browser there are lots of things you can do like take a screenshot, print a PDF or get the page content. With GraphQL there is an interface layer to do this as well as returning specific data from a webpage.

The article has various code examples for different use cases, such as taking screenshots, extracting table data, and creating PDFs from web pages using Google Apps Script and saving the data in Google Drive. Bruce is providing access to his combined Puppeteer/Cloud Run/GraphQL solution, gql-puppet but you can also find out how you can deploy it as your own service.

Source: Puppeteer, Cloud Run and GraphQL together – Desktop liberation