AppsScriptPulse

What’s new for developers building solutions on Google Workspace – mid-year recap


Google Workspace offers tools for productivity and collaboration for the ways we work. It also offers a rich set of APIs, SDKs, and no-code/low-code tools to create apps and integrate workflows that integrate directly into the surfaces across Google Workspace.

Here’s a very useful recap of recent announcements that should interest Workspace Developers. The post covers a range of Google products cover Docs, Chat, Meet and more. For developers particularly interested in finding out might is coming for Google Apps Script there are a couple of announcements:

The eagerly awaited project history capability for Google Apps Script will soon be generally available. This feature allows users to view the list of versions created for the script, their content, and different changes between the selected version and the current version.

It was also announced that admins will be able to add an allowlist for URLs per domain to help safer access controls and control where their data can be sent externally.

Details for both of these are still to hit the Google Workspace Updates blog, but with Next around the corner hopefully there will be more information very soon.

Source: What’s new for developers building solutions on Google Workspace – mid-year recap

Announcing AppSheet database General Availability!

Image credit: Google

We are excited to announce the General Availability (GA) of our native data store: AppSheet database. Our goal is to blend the simplicity of a table-driven data editing interface with the performance and scale of a relational database for non-technical users.

During testing, AppSheet database was faster than Sheets for processing adds, updates, and deletes of larger tables. In other words, the performance benefits of AppSheet databases are more apparent for a table with 50,000 rows compared to a table with 1,000 rows. AppSheet databases also have better support for concurrent edits.

It’s also worth noting that quick sync is enabled by default for all apps backed by AppSheet databases, even for security filters, so data updates automatically for app users.

Google AppSheet Databases went into public preview in October 2022, the announcement and context being covered in the Pulse post ‘Introducing AppSheet databases: Build data driven apps for Google Workspace‘. The recommendation while AppSheet databases were in preview was not to use them for production as there may have been breaking changes, which limited how much testing I could do, but I still found the occasional prototype project to give them a try. As noted in the general availability announcement the performance is more noticeable on databases with more rows. Where I saw big gains were around ‘quick sync’, particularly when making changes using the AppSheet API.

Something to keep in mind before lifting/shifting your existing Google Sheet based AppSheet apps are the usage limits. For example, Google Workspace customers eligible for the AppSheet Core licence at no additional cost are limited to 2,500 rows per database and 10 databases. The 2,500 rows is also the total amount across all tables in a database, for example, you will hit your quota if 1 database has 5 tables with 500 rows. Moving up to AppSheet Enterprise Standard increases the limit to 200,000 rows with a current maximum of 50,000 rows per table. In the later case Google have said this is a current technical limit and they are looking at increasing this soon. For AppSheet Core users it doesn’t sound like Google will be increasing the quotas anytime soon so it is worth making sure your data source and/or licence aligns with your anticipated data needs. There is an active discussion about usage limits in the source post.

Source: Announcing AppSheet database General Availability!

NEW Google Chat Import Mode APIs to support message platform migration are now in developer preview

We’re excited to announce that new Google Chat Import Mode APIs are now available in the Developer Preview Program! Import Mode allows developers to import data from other messaging systems while maintaining historical timestamps for messages and spaces. Data from large channels can be copied into Chat spaces silently without notifying the user, sending emails, etc until the admin is ready to have users start using the new space in Chat.

Google are continuing to add developer features to the Google Chat platform, the latest being Import Mode APIs. Theses APIs are designed to help when transitioning from other messaging platforms to Google Chat. Google highlight the following advantages of the new Import Mode APIs:

  • Preservation of resource creation timestamps. You can set a historical time for the creation times of space and message resources, letting Chat apps retain historical context during user adoption of Google Chat.
  • End users can’t view or access spaces in import mode. To prevent user interference of a space undergoing data import, or to avoid possible user confusion as a result of viewing an in-progress data import, spaces in import mode are hidden from end users. After a space has completed import mode, you can add users to the space.
  • Chat turns off notifications during import mode, so that users can avoid unnecessary alerts about the migration. [Ref]

The new Import Mode APIs are currently in Developer Preview and if not already part of the preview program the linked page includes information on how to join.

Source: Overview of developing Google Chat apps to import user data  |  Google for Developers

Using Apps Script tasks as part of Google Cloud Application Integration workflows

Application Integration is an Integration-Platform-as-a-Service (iPaaS) solution in Google Cloud that offers a comprehensive set of core integration tools to connect and manage the multitude of applications and data required to support various business operations.

The Application Integration platform provides a unified integration designer with out-of-the-box triggers, custom-configurable tasks, and plug-n-play connectors. The integration designer is a drag-and-drop interface that lets you create your entire integration flow with little or no code. You can create, modify, and run all your integrations in the integration designer.

I recently rediscovered Google’s new Application Integration service, which is currently in preview. If you are unfamiliar with this service it in part “offers a drag-and-drop visual interface that lets you create an entire integration flow with little or no code. Connectors also allow you to call and perform operations on various entities”.

There are a long list tasks that can be configured for Google Cloud services, but you are not limited to just these and you can add your own data sources. As a Google Workspace Developer, it’s been interesting to look at the Apps Script task integration. With this you can get task parameters from your integration, run any operations as you would with any other Apps Script project, with the option to set integration variables for the rest of your workflow.

The linked documentation page provides setup instructions. When you setup the Apps Script integration it creates a project with some boilerplate including adding a AppsScriptTask library. Lots of possibilities to use the Apps Script built-in and advanced services to rapidly create applications. I’m looking forward to seeing what the community come up with.

Source: Apps Script task | Application Integration  |  Google Cloud

Google Chat developer platform release notes – new Chat APIs generally available

Video credit: Pablo Felip Monferrer / @pfelipm

Build Chat apps that bring your services and resources right into Google Chat, letting users get information and take action without leaving the conversation.

Google has been spending a lot of effort recently adding features to Google Chat. This just hasn’t been limited to the user interface and Google recently announced a long list of new Chat API methods are now generally available. For Google Workspace developers and administrators this opens up more opportunities to manage chat messages, spaces and membership.

For Apps Script developers I think it’s unlikely you’ll see a ChatApp or a Chat Advanced Service, but with an OAuth2 library you’ll be able to make calls to the Chat REST API. With the new Google Chat API methods comes the ability to access user data and perform operations on the authenticated user’s behalf. I don’t think it will take long before we see example solutions appearing from the community and given this video from Pablo Felip Monferrer I’ll be keep a close eye on his blog pablofelip.online.

Source: Google Chat developer platform release notes  |  Google for Developers

Generate and send PDFs from Google Sheets with Google Apps Script 

Automatically create PDFs with information from sheets in a Google Sheets spreadsheet. Once the PDFs are generated, you can email them out directly from Sheets. This solution focuses on creating custom invoices, but you can update the template and script to fit your needs.

Today as part of a customer Google Apps Script introduction workshop, we covered a basic invoice / PDF example. By coincidence this month’s Google Workspace Developers Newsletter highlighted a solution spotlight from the Apps Script samples catalogue which does something very similar.

A trick I learned today from our Lead Workspace Trainer, Tim McLardy, was rather than using UrlFetchApp to get a PDF version of the Google Sheet with the export/?format=pdf url, is instead getting the Google Sheet as a blob and creating a pdf with DriveApp.createFile(). As this technique will generate a PDF with pages with all your Sheet tabs the trick is to selectively hide all but the tabs you want in your PDF. In the case of the example linked as the source post you can rewrite the createPDF() function as:

/**
 * Creates a PDF for the customer given sheet.
 * @param {string} ssId - Id of the Google Spreadsheet
 * @param {object} sheet - Sheet to be converted as PDF
 * @param {string} pdfName - File name of the PDF being created
 * @return {file object} PDF file as a blob
 */
function createPDF(ssId, sheet, pdfName) {
  // Based on https://webapps.stackexchange.com/q/162155/30021
  const ss = sheet.getParent();
  const sheets = ss.getSheets();
  // Hides all sheets that are not the main one
  sheets.forEach(s => {
    if (s.getSheetName() !== INVOICE_TEMPLATE_SHEET_NAME) {   
      s.hideSheet()
    }
  });
  
  // make a pdf of the sheet
  const folder = getFolderByName_(OUTPUT_FOLDER_NAME);
  const pdfFile = folder.createFile(ss.getBlob()).setName(pdfName);
  
  // show all the sheets
  sheets.forEach(s => s.showSheet())
  return pdfFile;
}

Source: Generate & send PDFs from Google Sheets  |  Apps Script  |  Google Developers

A tool for exploring and testing Google Workspace APIs

Image credit: Google

We recently launched the Google Workspace APIs Explorer, a new tool to help streamline developing on the Google Workspace Platform. What is this handy tool and how can you start using it?

The Google Workspace APIs Explorer is a tool that allows you to explore and test Google Workspace APIs without having to write any code. It’s a great way to get familiar with the capabilities of the many Google Workspace APIs.

The Google Apps Script editor bakes in some nice features including inline documentation to help when you are coding your script project (and if you don’t already know, next time you are in the online script editor press ctrl + space :). To help with discovery Google have recently published the Google Workspace APIs Explorer website, which lets you see and test a range of Google APIs. For Google Apps Script developers this site is a great way to help you understand how you can use the Advanced Services (my tip for Workspace admins is to check out the Directory and Report API which as part of the Admin SDK API Advanced Service).

Source: A Tool for Exploring and Testing Google Workspace APIs

 

Google Workspace Developers ‘ask me anything’ and the future of Apps Script #AppsScriptAMA

The Google Workspace DevRel team have recently kicked off an ‘ask me anything’ #AppsScriptAMA campaign on Twitter:

You can find recent questions/answers using this Twitter search. There was one answer that caught my eye from @mtfan about the future of Google Apps Script:

The YouTube short response doesn’t give much away in terms of big feature updates, but the long waited Apps Script project version control sounds like it might be arriving soon.

Build your first AppSheet app: How I built a food tracker (with AppSheet Databases)

I keep forgetting what I have in the freezer. At first I used Google Sheets to keep track of it, but I wanted something that was easy to consult and update on my smartphone. So I turned to AppSheet! Here’s a tutorial to follow to make a similar tracking solution.

This post on the Google Developers blog covers the basic steps for creating an AppSheet app using AppSheet Databases, which are currently in public preview. I’ve recently also been having a play with AppSheet Databases, and I’ve been impressed with the improved performance whilst also keeping them simple to use. I’ve encountered a some issues when setting up columns as references so not ready for prime time yet. Projects like the one mentioned in this post are a great way to ‘kick the tyres’ and experience yourself.

Source: Build your first AppSheet app: how I built a food tracker

Google Workspace Developer Summit – Toronto and Chicago March 9 & 14, 2023 

Calling all #GoogleWorkspace Developers! The Google Workspace Platform team will host two Developer Summits at Google Toronto (March 9th) and Google Chicago (March 14th).

The Google Workspace Developer Relations team are on the road again with their latest Developer Summit. This time the team will be hitting Toronto and Chicago. The events are a great opportunity to discuss the Google Workspace platform vision, meet other Google Workspace developers and visit one of the Google offices. Attendance is free and you can find out more about the event and register your interest to attend via the source link.

Source: Google Workspace Developer Summit – Toronto and Chicago