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.
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.
Learn how to automatically transcribe audio and video files in Gmail messages with the help of OpenAI speech recognition API and Google Apps Script
Amit Agarwal highlights a no-code solution for transcribing audio in Gmail attachments available in his ‘Save Gmail to Google Drive’ Google Sheets Add-on. As part of this he shares the code and tips for transcribing audio files using OpenAI’s Whisper API. When you look at the snippet provided you’ll see once the audio file is in Google Drive it is very easy to use the Whisper API to get a transcript.
Text-to-speech services aren’t new, but approaches and larger training datasets are improving accuracy and if you prefer to work in the Google ecosystem you can find out more about Cloud Speech-to-Text.
Learn how to use the Udemy API with Google Apps Script to find free programming courses on Udemy on any topic.
A double win in this post from Amit Agarwal. Not only can you get a list of free programming courses currently running on Udemy, but Amit includes the code snippet used to get/add these to a Google Sheet. This might be useful if you are working with other APIs and are looking for a code snippet to help format the data in a Google Sheets friendly format.
you can use the following Apps Script to create folders in Google Drive for students and share those folders with their email addresses based on data from a Google Sheet
Whilst this post from Amit Agarwal looks at the automatic creation of Google Drive folders, it’s also worth having a look at it at for an Apps Script pattern for iterating over and processing data from Google Sheets. In particular there is a getStudentData()function that turns the 2D array return from .getValues() into an object array which includes a rowIndex. This makes it easy to update your Google Sheet when each row is processed.
There are two ways to pull email addresses from Gmail messages. The simpler, and more popular, method is that you pull a list of messages from which you wish to extract the email and loop over them to extract the email addresses. A more efficient way to pull email addresses from multiple email messages is to make a single batch request to the Gmail API with the help of Apps Script’s UrlFetch service.
We’ve featured a couple of posts on how you can make batch requests with Google Workspace APIs. With the limited runtime in Apps Script using batches can be an invaluable tool to finish your script in the execution limit and also improve your user experience. In this particular example for Amit Agarwal he looks at how batch requests can be made to the Gmail API by first get message details from a call to Gmail.Users.Messages.list, before getting message details in a single UrlFetchApp.fetchAll call. All the example code is included in the source post and to get to execute it copy/paste/run the following function:
A familiar story I hear is people with no formal coding experience starting their developer journey with Google Apps Script. I find being able to run small snippets of code are a great way to learn and a number of sites like W3 Schools and also increasingly Stack Overflow include the ability to ‘try it yourself’ with inline code runners.
If you are looking to support users getting started with Google Apps Script Amit Agarwal has this little code snippet which lets you inline/run Google Apps Script code in Google Docs. There are both limitations and considerations with this approach but as a quick way for learners to run and collaborate on small snippets, which can be contextualised with explanatory text/resources, it’s a nice starting point. Check out the source link for more details.
The Document Studio add-on helps you automatically send text messages when a new Google Form is submitted or when new rows are added to Google Sheets. You can thus build workflows that send text reminders when the invoices are due. Or you can get notified instantly when people fill out your Google Forms.
There was some speculation this week about how much revenue Amit Agarwal (Digital Inspiration) makes through his suite of Google Workspace Add-ons. I can neither confirm or deny the reported figures, but what I’m certain of is Amit is not only an expert developer but also clearly very talented at spotting opportunities and creating very slick user experiences.
This latest post from Amit is a case in point. No code, but plenty of screenshots demonstrating how users of his Document Studio add-on can integrate a SMS text service into Google Forms/Sheets. As this is achieved with a Webhook integration users aren’t limited to SMS services. Click through to the source link to see more screenshots similar to the one below:
Learn how to automatically preserve the formatting in Google Sheet when new Google Form responses are submitted.
Handy little Apps Script snippet from Amit Agarwal should you need to keep any custom formatting applied to linked Google Forms responses in Google Sheets. Another way you can approach this is using ARRAYFORMULA to reference the form responses in another sheet and apply your desired formatting.
The default ‘Form responses’ sheet can be hidden if needed. Downside of using ARRAYFORMULA is you are referencing a cell range which can cause confusion when using features like sort. See the source link for all the code used in Amit’s solution.
Learn how to use the WhatsApp API to send personalized messages from Google Sheets to your WhatsApp contacts.
The question of how to automate WhatsApp using Google Apps Script has come up several times in the community forums. This has been notoriously difficult and also unreliable as Workspace developers had to often find workarounds without easy access to the WhatsApp Business API.
Send and receive messages using a cloud-hosted version of the WhatsApp Business Platform. The Cloud API allows you to implement WhatsApp Business APIs without the cost of hosting of your own servers and also allows you to more easily scale your business messaging.
Amit Agarwal hasn’t wasted any time in publishing a growing number of tutorials specifically for Google Apps Script developers and Google Workspace users on sending messages to WhatsApp. This first tutorial from Amit provides information on setting up a WhatsApp application on the Meta developers website and the Apps Script code required to send a message.