Using webhooks to interact with Google Chat using Google Apps Script

Learn how to conduct a pirate raid in Google Chat Spaces with Webhooks and Google Apps Script. Video Included.

Google continue to add and enhance Google Chat. The fun doesn’t stop at the end user experience, Google also adding functionality to the Google Chat API. A low-lying entry point for Google Workspace developers is using Google Chat webhooks. As a HTTP endpoint you can use your coding language of choice.

In this tutorial from Scott Donald you can learn how Google Apps Script can be used to interface Google Chat using webhooks. The post includes everything you need to get started including a tutorial video. There are some nice tips including how to post replies to a chat thread and formatting responses using the card service. Follow the link to start learning more…

Source: Creating Webhooks for Google Chat App with Apps Script – Yagisanatode

Creating and using a settings section in Google Sheets for your Apps Script projects


Image credit: Dimitris Paxinos

Create a reusable settings page in Google Sheets, using Apps Script, where configurations are easily accessible, even to those without a coding background.

I’ve not seen the numbers but would imagine the majority of Google Apps Script projects are script bound to Google Sheets. Google Sheets provide a useful data canvas which is familiar to users, which can also be used to quickly interface your script solutions. You could of course use dialogs and sidebars combined with the Properties Service to collect and store settings, but coding these in HTML/JavaScript can be time consuming.

This post from Dimitris Paxinos includes a nice Apps Script code pattern for getting and setting user settings from a Google Sheets tab. This includes some nice features including in memory storage and methods to use Script Properties. The post includes an accompanying video which explains the code should you need additional help understanding this solution.

Source: Creating a Settings Section in Google Sheets Apps Script Projects

Creating a custom Google Apps Script project version history 

This report introduces the method for managing the histories of the Google Apps Script project.

On August 23, 2023, the project history has been implemented in the new IDE of Google Apps Script. In the current stage, the users can see the history of the previously deployed script version. … In the case of the classic IDE, the users had been able to see the previously saved script version regardless of the deployment and just the save of the script. This is not implemented in the new IDE.

In August 2023, Google updated the online Apps Script Editor adding a feature which lets you view previously deployed script versions and compare them to the current script version. A current limitation the history is limited to versioned deployments. As noted in this source post from Kanshi Tanaike, deployments require several steps and you have to remember to go through the process. To make the process easier Kanshi has published a ScriptHistoryApp library, which can be used to create a custom web interface for making your own Apps Script project version history. Perhaps more usefully you can also manage snapshots of your script projects by fetching a URL. This makes it easy for you to either regularly save a project on a timed trigger or an event based mechanism.

Source: Managing History of Google Apps Script

[Event] Connected Workers: Using AppSheet to bring the frontline and head office together – Online October 19, 2023 at 14:00 UTC

Join us for an exciting showcase event with Google presenting an AppSheet demo developed to connect frontline workers with head office.

On October 19, 2023 at 14:00 UTC you can join me for a free online live webinar with Tony Martin, Google Workspace specialist and Dominic Parkes, Google Workspace Customer Engineer at Google to discuss a demo app created in Google AppSheet to help bring frontline/deskless workers and head office together more efficiently.

This session is an opportunity to discover how AppSheet can be used to make it easy to administer everyday business tasks such as: reporting sickness, managing shifts, payslips and HR records, onboarding and training. We’ll be discussing the benefits of using AppSheet to solve this problem and getting Tony and Dom’s top tips when it comes to Google AppSheet app creation.

Follow the source links to reserve your place…

Source: Connected Workers: Using AppSheet to bring the frontline and head office together – CTS Website

Request Google Analytics data for Google Sheets using natural language with the PaLM API and Google Apps Script

This video shows how to use the Palm API with Google Apps Script to extract data from Google Analytics 4 accounts. This can be useful for a variety of purposes, such as creating custom reports, automating data analysis, and building new data-driven applications.

Following on from the last post in Pulse where we looked at using Google PaLM API and MakerSuite in Google Apps Script, here’s another example from GDE Linda Lawton. As the video in the post shows Linda has been able to engineer prompts that allow you to use natural language to extract reports from Google Analytics. This shows the emergent capabilities of LLMs as well as some clever prompt engineering. The source post contains more detail, but here is an example:

var text = "The current date is '"+ date + "'. Create a JSON object which contains five parameter's dimension, metrics, start_date, end_date and property_id. The dimension and metric parameter's will be comma separated strings they can be empty if there is no valid text for it. The value of the dimension parameter should be a comma separated string of these dimensions names 'country, eventName, city, audienceName' and the value of the metric parameter should be a comma separated string of these metric names 'activeUsers, eventCount, screenPageViews', the property_id field will also be a string it will be a large number, start date and end date must be in the following format YYYY-MM-DD, which can be found in the given this text '" + prompt + "'. If no start date is found use set it to seven days ago and if no end date is found set it to today."

A couple of highlights worth noting:

  • Context – The current date is included programmatically to give the LLM a reference point
  • Reinforcement – ‘start date and end date must be in the following format YYYY-MM-DD’
  • Exceptions – ‘If no start date is found use set it to seven days ago and if no end date is found set it to today’

Source: GA4 + Palm API with Google App script

GenAI for Google Workspace: Exploring the PaLM 2 API and LLM capabilities in Google Sheets with Google Apps Script — Part 1

This post has covered how you can quickly copy MakerSuite code examples to run them in Google Apps Script. To make the iterative process easier I’ve created GenerativeLanguageApp so that once you’ve created/saved an API key, you can drop these code snippets into your Google Apps Script project:

Generative AI (GenAI) is a rapidly developing field that has the potential to revolutionize many industries, including the way we work. Google has developed a number of LLMs that are generally available to developers, including foundation models trained for text, chat and code which are accessible as part of the PaLM 2 API. To help developers explore the capabilities of these models, Google has created the MakerSuite site.

In this post I share GenerativeLanguageApp, a Google Apps Script helper class which makes it easy to quickly copy MakerSuite code examples to run them in Google Apps Script. This is a great way to start experimenting with LLMs and seeing how they can be used in Google Workspace.

In the next part of this series, I’ll explore some of the capabilities of when using the PaLM 2 API with data from Google Sheets. Stay tuned!

Source: GenAI for Google Workspace: Exploring the PaLM 2 API and LLM capabilities in Google Sheets with…

Efficiently deleting rows by conditions in Google Sheets with Google Apps Script

In this report, I would like to introduce a sample script for efficiently deleting rows by conditions on Google Spreadsheet using Google Apps Script. Recently, I had a situation for being required to achieve this situation. In my report, it has already known that when Sheets API is used, the rows can be efficiently deleted by a condition. Ref However, in that case, Sheets API couldn’t be used. Under this situation, I came up with a method. In this report, I would like to introduce this method.

Here’s a clever method from Kanshi Tanaike for deleting rows in Google Sheets based on a column condition. The solution makes use of the built-in .removeDuplicates() method, the clever bit is the script first copies the header row into any row that matches the condition. As this creates duplicate rows the .removeDuplicates() method can be called to the entire data range. Using this method Kanshi was able to improve an execute of an earlier function from 67 seconds to 13 seconds!

Source: Benchmark: Efficiently Deleting Rows by Conditions on Google Spreadsheet using Google Apps Script

How to Write to a JDBC Database with Google Apps Script: My Adventure with a Pesky Character Limit

I recently faced a frustrating issue when writing data to a CloudSQL database with the JDBC class in Apps Script. I kept getting the following error:

Exception: Argument too large: SQL

I also observed that it only happened when my SQL query reached a certain length. I considered breaking it down into multiple queries, but I was still puzzled 🤔 because I was only sending a few dozen kilobytes of data.

Now, the thing is, the official documentation could be more helpful; even though the solution is there, it needs to be better explained. So, I turned to StackOverflow. There was a discussion on this exact topic, but to my surprise, I was still waiting for an answer. Until, well, I wrote it 😉

Source: How to Write to a JDBC Database with Google Apps Script: My Adventure with a Pesky Character Limit

Become a recognized AppSheet Google Developer Expert (GDE)!

Image credit: Google

If you have strong AppSheet technical skills along with solid Google Workspace skills and would like to share your expertise globally as a recognized “Google Developer Expert” (GDE), we would like to invite you to apply to become an official GDE member specializing in AppSheet and Workspace!

The Google Developer Experts program is a great way to get recognised for your abilities, but more importantly an opportunity to get close to the Google product teams to learn and share your day-to-day experiences. Whilst AppSheet is positioned as a no/low code solution it doesn’t mean there aren’t individuals out their developing sophisticated apps and supporting the community along the way.

If this sounds like you the AppSheet team are looking for community experts to become the next AppSheet GDEs. This source post includes some more information as well as a form where you can note your interested. As a GDE of 9+ years I’m also happy to share my experience of the program and what I think it takes to stand out from the crowd.

Source: Become a recognized AppSheet Google Developer Expert (GDE)!

[Official] Apps Script project history – New Feature overview!

We are excited to announce the general availability of project history for Apps Script! Find out how you can get started using this feature.

In Pulse we’ve previously featured the announcement that the new project history was rolling out to Google Apps Script. This feature should have finished following out and this video from the Google Workspace team covers how you can use project history in the Apps Script IDE. As well as the video there is also an update to the Google Apps Script Versions documentation page.

The key takeaway for Google Apps Script users is unlike Google Docs which can automatically save a version history of a document, Apps Script project history requires the user to use deployments (Deploy > Manage deployments) to create a version should you want to see get a highlights or code changes between the current and previous versions. This will be less of an issue if you are using Google Apps Script to  deploy web apps, Workspace Add-ons or libraries, which already use deployments, but for other situations like container bound scripts you might want to get into the habit of using the Deploy button to create a version.

Source: Apps Script project history – New Feature!