AppsScriptPulse

GWAOw! 4 – Forms History a Google Forms Add-on by Martin Hawksey

Forms History is a Google Workspace Add-on that allows you to monitor your version history and store copies in Google Forms

Not just talking the talk, but also walking the walk. Shortly before taking a new role at CTS, the largest dedicated Google Cloud Partner in Europe, I published Forms History an add-on to enable revision history functionality in Google Forms.

Fellow Google Developers Expert, Scott Donald, has picked this up in the latest episode of GWAOw! his dedicated to Google Workspace Add-on review show. You can follow the source link for the YouTube clip and more. As part of the episode Scott rightly highlights the creative work of Alice Keeler, which hasn’t just included artwork but Alice has also provided a huge amount of support in promo and usability.

If you are interested in the inner workings of Forms History there is a related post on Working with the Google Drive API Revisions history: Tips for handling revision merges with Google Apps Script.

Source: GWAOw! 4 – Forms History by Martin Hawksey – Yagisanatode

Retrieving Smart Chip dropdown values from Google Docs using Google Apps Script

This is a sample script for retrieving the values of dropdown list of the smart chips on Google Document using Google Apps Script.

At August 23, 2021, 3 Classes for retrieving the smart chips have been added to Google Apps Script. But, in the current stage, unfortunately, all values of the smart chips cannot be retrieved by the Classes. For example, the dropdown list of the smart chips cannot be retrieved

Incredibly useful report and workaround from Kanshi Tanaike for Google Workspace Devs needing to get some ‘smart chips’ values from Google Docs. Hopefully classes/methods will be added to Apps Script and the Google Docs API (here is a related feature request you can star in the issue tracker), particularly as the current solution is to convert the Google Doc to .docx and then back to Google Doc.

Source: Retrieving Values of Dropdown List of Smart Chips on Google Document using Google Apps Script

Move column positions in Google Sheets with Google Apps Script

Move columns in a Google Sheet

Move columns in a Google Sheet

The following Google Apps Script is designed to reposition 2 columns within a Google Sheet. It is a small and simple bit of code but it was something new to me when I was collating lots of files together and appending columns at the end – which then needed to be moved.

In this example I am moving columns ‘collegename’ (E) and ‘shoesize’ (F) to the left of ‘postcode’ (D). So that ‘postcode’ will be the final column (F).

Source: The Gift of Script: Move Column Positions

Programmatically manage and apply Drive Labels using new API functionality

Many of our customers already take advantage of the Drive Labels capabilities to classify content and implement policies on their Drive files for governance and Data Loss Prevention.

Today, we’re happy to announce a highly requested update that will enable you to programmatically manage labels at scale via Drive APIs.

Google Workspace devs might be interested in this update to the Drive Labels API which enables additional functionality. As noted in the source post:

The new Drive Labels API supports reading Drive Label taxonomies. New functionality in the Drive API can be used to apply labels, set fields on files, and find files by label metadata. As a whole, these new API features enable numerous use cases including, bulk-classification, Apps Script driven workflows, third-party integrations, and other organizing and finding needs.

The post includes links to a number of useful resources including reference documentation.

Source: Programmatically manage and apply Drive Labels using new API functionality

Creating Google Workspace Chat Apps: What developers need to know – [online event 24 August 2022 16:00 – 16:45 UTC]

Image credit: Google

Teams and organizations are shifting to Google Chat as their primary way to stay connected and collaborate in real time, giving developers the unique opportunity to build Chat-integrated Google Workspace apps to help their users do more. In this session, we’ll discuss use cases for chat apps, the architectural options you can choose from, and how to get started building your own. Make sure to bring your questions!

Charles Maxson and Chanel Greco are both top presenters and they will be teaming up on the 24 August 2022 for a Google Cloud OnAir event to share the latest on Google Chat app development. For those unfamiliar there are various platforms/architectures for developing Chat apps, one of which is Google Apps Script. You should be able to find out more about this and more at the session.

Source: Creating Google Workspace chat apps—what developers need to know

Benchmark: Process cost for Parsing XML data using Google Apps Script

Note: Process time has been graphed on a log scale

In order to retrieve the values from XML data, when XML data is parsed using Google Apps Script, there are several methods for parsing the data. … For example, Class XmlService cannot only parse and read XML data but also update XML data and create new XML data. In the current stage, the process cost of Class XmlService is much higher than those of “cheerio” and the simple script using regex.

In Pulse we’ve previously highlighted the cheerio JavaScript library for parsing/extracting content from XML data. The cheerio library can easily be added to Google Apps Script projects as a library (see the GitHub repo for installation). Google Apps Script also has the XML Service, which can also be used to work with XML data. In this latest benchmark report from Kanshi Tanaike they look at the process cost for reading XML data using XML Service, cheerio and using RegEx. The results highlight a higher process cost for using XML Service particularly if you are handling reading 1,000 or more XML elements. The source post contains further details of the test and a summary of the results.

Source: Benchmark: Process cost for Parsing XML data using Google Apps Script

Dependent dropdown lists for Google Sheets (and lots of other Google Apps Script goodies)

Updated the script for dependent lists, and now it supports new options. New for 2022:

Dependent drop-down lists can be used to create a dynamic list of choices in Google Sheets. When the user makes a selection from the first drop-down list, the choices in the second drop-down list will be updated based on the selection. This can be used to create a cascading list of choices.

If you are looking for a nice solution to build dependent drop-down lists in Google Sheets this is a great solution from Max Makhrov. For more experienced Google Apps Script developers the solution incorporates some clever snippets both from Max and a number of other members of the community. Some highlights include: converting a column index into corresponding column letter; a tasker to batch apply updates to a Google Sheet; ChuckyCache for objects above 100Kb; and a reference to a zip compression solution. All these are referenced in the source code provided in the post.

Source: Dependent Drop-Down Lists For Google Sheets v2022

Quickly format multiple Google Sheets with Apps Script

In this post, we’re going to see how we can very quickly format multiple Google Sheets with a little help from Apps Script.

The idea of this post, came from the Department of Education in Hawaii, where they have over 300 schools and a guy who works there told me he had to format over 300 Google Sheets the same way, and wondered how this could be done with Apps Script.

Easy I said! And I thought it was a typical example of how a little knowledge of Apps Script can help you speed up your work and allow you to spend less time doing boring, repetitive work, and focus more on the data itself.

Let’s see how it’s done!

This is a nice real world example of how Google Apps Script can be used to make a manual routine task more efficient. The post by Baz Roberts includes a detailed explanation of what is going on in the code making it also a great learning resource. If you have some more complicated Google Sheets formatting in mind you might want to also look at Google Sheets Macros, which lets you record every action you take within the spreadsheet creating a script you could call similar to the format functions included in the post.

Source: Quickly format multiple Google Sheets with Apps Script (also available on bazroberts.com)

GWAOw! 3 – Crop Sheet by Eric Koleda (how to keep Google Workspace Add-on development simple with custom menus)

Crop Google Sheet Data to the data range or a selection in 2 button click with Crop Sheet. Full Walkthrough

Does this Google Workspace Add-on developer story sound familiar? You are able quickly write the code that executes your add-on functionality, but then you spend days buried in HTML or Card Service making the UI. The Crop Sheet add-on by Eric Koleda highlighted in this latest GWAOw! episode is a great example of what is possible just by using custom menus. For what it is worth the source code (all 73 lines including comments!!!) is on GitHub. Follow the source link for the video demo from Scott Donald and links including the GitHub repo.

Source: GWAOw! 3 – Crop Sheet by Eric Koleda – Yagisanatode

Automatically backup Google Drive folders to Cloud Storage with Google Apps Script

Image credit: Stéphane Giron

Few days ago, with the launch of French region ‘europe-west9’ in GCP, I made an apps script to backup a Drive folder to Cloud Storage. It is a cool script and works nicely but after some exchange, we can make it better.

So here I come back with onleebackup an open source code to backup multiple Google Drive folders to cloud storage with synchronisation.

A very interesting open source project from Stéphane Giron which lets you backup Google Drive folders to Google Cloud Storage. An important caveat is with Google Apps Script limitations like script runtime and URL Fetch POST size this won’t work if you have gigabytes of data. The code has some nice features like handling Google Docs/Sheets/Slides file types, converting them to equivalent MS Office formats as well as management of Google Drive shortcuts, which requires calls to v3 of the Google Drive API. The source post provides details for setting up onleebackup, which also includes a link to a previous post with code highlights.

Source: Automatically backup Google Drive folders to Cloud Storage