AppsScriptPulse

Bringing JSON Data from an API into Looker Studio with Google Apps Script

Learn how to seamlessly integrate JSON data from an API into Looker Studio using a custom connector built with Google Apps Script.

This post is a useful reminder of that Google Apps Script can be used to make a data connector for Google online visualisation and reporting tool, Looker Studio. The post by Dimitris Paxinos covers all you need to know about integrating a third-party API as a data source, exposing configuration settings and deploying the connector. All the code is on Github and is a great boilerplate if you have other APIs you are interested in integrating.

Source: Bringing JSON Data from an API into Looker Studio

How to extract images from Google Docs and Google Slides using Google Apps Script

Learn how extract all the embedded images from a Google Document or Google Slides presentation and save them as individual files in a specified folder in your Google Drive.

Often I’ll use Google Docs for drafting blog posts. With the introduction of Duet AI having a generative assistant in situ helps with the creative process. As well as text Google Docs is a really simple canvas for quickly copy/pasting screenshots. Copying content from Google Docs to WYSIWYG editors can sometimes be challenging, particularly, when it comes to images.

Next time I encounter this problem I’ll be using the script solution from Amit Agarwal, which can extract images from Google Docs and Slides and save them to Google Drive. I’m sure there are many other situations where this snippet could come in handy.

Source: How to Extract Images from Google Docs and Google Slides – Digital Inspiration

Autofill Google Sheet formula each day with Google Apps Script

Check a Google Sheet once per day and if the date is in the past Autofill another row of formulas.

Example screenshot of a Google Sheet with columns and dates that are used to perform calculations.

Autofill Google Sheet formulas each day

The following Google Apps Script is designed to check a Google Sheet once per day and if the date is in the past it Autofills another row with the existing formulas used across the columns. This post is a variation of the Autofill Google Sheet Formula one.

Source: The Gift of Script: Autofill Google Sheet Formula each day

Google AppSheet rolling out new visual editing features

 

We are excited to roll out to GA (General Availability) our first visual editing features to all AppSheet creators, starting today.

This a new way for AppSheet creators to make changes to their apps and navigate the editor. It’s intuitive for anyone to point at what they want to change if they can see it. We are now letting you do that in the editor: you can now hover on visual components of the editor’s app view and see possible editor actions for the outlined component.

Google recently announced the rollout of new new visual editing features in AppSheet. The new feature should help simplify and speed up app development (see the source post for an animated gif / video of what it looks like). In the announcement Google mention that the new feature isn’t available for all components:

Outlines are only available for some components visible in the app. For instance, Detail and Form Views have a lot more controls than the Deck View right now. Additionally, only some Editor actions are available, such as navigating users to Data components, View components, Action components and some of the general Settings.

More updates are planned and if you don’t see this feature in AppSheet yet the rollout has been paused for Google Cloud Next and should be available for everyone soon.

Source: First visual editing in the AppSheet editor

PDFApp and many recipes for ‘cooking’ PDFs with Google Apps Script

Unfortunately, there are no built-in methods for directly managing PDF data using Google Apps Script. Fortunately, after the V8 runtime has been released, several raw Javascript libraries could be used with Google Apps Script. pdf-lib is also one of them. When this is used, PDF data can be cooked over Google Apps Script. In this report, I would like to introduce achieving this using a Google Apps Script library.

Google Apps Script is a powerful tool for automating tasks. It can be used to process data, create spreadsheets, and send emails. One of the limitations of Apps Script is that it does not have built-in support for PDF files. However, there are a number of third-party libraries that can be used to work with PDF files and in Pulse we’ve featured a number of posts from Kanshi Tanaike where they have explored the pdf-lib is a JavaScript library.

This work has culminated in PDFApp, a dedicated Apps Script library created by Kanshi Tanaike based on the pdf-lib, but optimised for Apps Script. The source post includes a number of recipes for handling PDF files listed below:

  • Export pages from a PDF
  • Get metadata of a PDF
  • Update metadata of a PDF
  • Reorder pages of a PDF
  • Merge PDF files
  • Convert PDF pages to PNG files
  • Get values from PDF form
  • Set values to PDF form
  • Create PDF form using Google Slide as a template
  • Embed objects into a PDF

The source code for PDFApp is also on GitHub if you want to dig further.

Source: Cooking PDF over Google Apps Script

How to programmatically enable push notifications/watches for file changes in Google Drive with Apps Script

Are you looking for a way to receive notifications in real-time when an important spreadsheet in your Google Drive get modified or is accidently deleted by sometimes? Well, Google Drive offers an API to help you set up a watch on any file in your Google Drive be it a document, presentation or even a PDF file. This means that you can receive instant notifications whenever the content or even permissions of that file changes.

This tutorial explains how you can setup watch notifications on any file in your Google Drive with the help of Google Apps Script.

As part of the Google Drive API you can set up watch notifications on any file in your Google Drive. This means you can receive instant notifications whenever the content or permissions of that file changes. This feature can be useful for a number of scenarios, for example,  if you have sensitive Drive files that you want to closely monitor, or a workflow where you’d like to trigger additional events when a file is updated.

This post from Amit Agarwal explains how you can create a push notification for a Google Drive file using Google Apps Script. As noted in the post you can use Google Apps Script to handle the push notification by creating a doPost Web App, however, not all the response data/headers are available using Google Apps Script. There is a related ticket which had some activity earlier in the year and I would encourage you to star the request to get updates and encourage Google to fix – https://issuetracker.google.com/issues/67764685.

Google Workspace Admins looking for domain/user activity on Drive files might want to look at the Reports API activities endpoint, which can be configured to setup similar watch notifications. You can read more in the Reports API: Drive Activity Report overview.

Source: How to Enable Push Notifications for File Changes in Google Drive with Apps Script – Digital Inspiration

Automatically save attachments for a Google Google to Google Drive using Gmail and Google Apps Script

 

Imagine you’re managing a Google Group, where important attachments are regularly sent. Manually saving these attachments to your Google Drive can be time-consuming and prone to errors. Is there a way to automate this process and ensure that you don’t miss any crucial documents?

It’s quite easy to tie yourself in knots when it comes to scheduling tasks in Google Apps Script to handle data created since the last run. This Medium post from Pablo Pallocchi shows a nice way your can structure Gmail searches using the after: operator combined with a ‘last execution date’ stored in Apps Script Properties Service. The result is a nice solution design to backup attachments sent to a Google Group to Google Drive. There’s lots of scope for extending and/or modifying this solution. All the details are in the source post.

Source: Automatically Save Email Attachments to Google Drive Using Google Apps Script

AppSheet Core licenses will be included by default for more Google Workspace editions, along with a new Admin security setting

To bring the power of AppSheet to more users, AppSheet Core licenses will now be included for the following Google Workspace editions…

By including AppSheet Core licenses in more Google Workspace editions, the power of AppSheet is accessible to more users. Further, Admins will have the security features they need to ensure their users are using AppSheet appropriately in their organization.

Previously AppSheet Core licenses were included with Workspace Enterprise Plus, Enterprise Essentials Plus, and Education Plus users. Google have recently announced that AppSheet Core licenses will also be included in the following Google Workspace editions:

  • Business Starter, Standard, and Plus
  • Enterprise Starter and Standard
  • Frontline Starter and Standard
  • Non-profits
  • Education Standard

This is great news for Google Workspace users as AppSheet includes a number of out-of-the box features which already integrate into other Workspace products, like dynamic emails, Google Chat and Google Apps Script integration.

Along with the expansion of Workspace editions getting AppSheet Core, is the news that Admins will have basic security controls which can disable external usage of AppSheet apps.

Looking at the associated new security settings support page, it was interesting to see that turning on AppSheet Core security will disable ‘external integration through the app API’:

This caught my eye as the AppSheet API is a feature reported as only being supported on AppSheet Enterprise plans:

Perhaps it’s a mistake in the AppSheet API documentation, but I hope not as the AppSheet API is an incredibly useful addition for developers to do more with AppSheet.

Finally a little plug. If you are interested in AppSheet and would like to find out about training and support services get in touch. At CTS, where I work, we’ve a growing reputation in both products built using AppSheet as well as helping you get the most from the platform in your organisation.

Source: AppSheet Core licenses will be included by default for more Google Workspace editions, along with a new Admin security setting

Let Bard answer your questions in Google Sheets with the PaLM API and Google Apps Script

 

Discover the magic of combining Palm API’s extraordinary capabilities with the limitless potential of Google Apps Script. In this blog we will be taking a look at how we use the PaLM API and Google Apps Script inside of a Google Sheet. We will be passing prompts from a Google Sheet and getting back a response. 

Learn how to integrate Google Bard responses inside of Google Sheets using the PaLM API and a little bit of Google Apps Script. Using Google’s MakerSuite it is easy to create an API key which you can use with a custom function in Google Sheets. Whilst the solution focuses on creating a custom function which would automatically refresh, using it programmatically to store responses could be a quick way to collaboratively experimenting with LLM text prompts.

Source: Let Bard Answer Your Questions from Google Sheets with the PaLM API and Google Apps Script

[News] MakerSuite expands to 179 countries and territories, and adds helpful features for AI makers

When we announced MakerSuite earlier this year, we were delighted to see people from all over the world sign up for the waitlist. With MakerSuite we want to help anyone become an AI maker and easily create innovative AI applications with Google’s large generative models. We’re excited to see how it’s being used.

Today, we’re expanding access to MakerSuite to cover 179 countries and territories, including anyone with a Google Workspace account. This means that more developers than ever can sign up to create AI applications with our latest language model, PaLM 2.

We’ve recently featured a couple of posts on Pulse mostly from Aryan Irani on getting started Google GenAI tools in Google Apps Script. As part of these Google MakerSuite, a tool that lets developers start prototyping with Google’s large language models quickly and easily, is used as part of the API calls to PaLM. MakerSuite is still in private preview, but the good news in the linked announcement that the waitlist has been expanded to 179 countries. Given how Google have rolled out other GenAI tools, in particular Bard, I’m not surprised that EU countries are still not included, but find it strange at time of writing the United Kingdom is still not on the list. Despite this the announcement is worth a read to find about some other new features including automatic text prompt tips and data import/export to Google Sheets and by CSV.

Want to write better prompts? Now, you can write a text prompt and click “Prompt Suggestion” to get ideas and suggestions to get better responses – Image credit: Google

Source: MakerSuite expands to 179 countries and territories, and adds helpful features for AI makers