Are you using Google Drive to share information with your staff? As the number of staff members increases, it can become increasingly difficult to manage permissions properly. I faced a similar issue. As the members of the team changed from time to time, setting access rights for each folder became a cost that could not be ignored. So I used Google Apps Script to create a tool to synchronize the permissions management table with the actual permissions.
We’ve previously featured Inclu Cat’s posts on ways to deal with Google Apps Script’s 6-minute execution limit [Ref 1 & Ref 2]. These posts continue to prove to be incredibly popular and usually feature in our most read list. Even if you aren’t interested in programmatically managing Google Drive file/folder permissions this post is a nice example of using the authors LongRun solution to process large amounts of data with Google Apps Script. From the source link you can find the GitHub repo with all the code you need and setup instructions.
Recently, I got the chance of giving a training on Google AppSheet at O’Reilly Media, Inc. … This was a three hour long training where I talked about the basics of Google AppSheet and how to create apps on Google AppSheet.
Aryan Irani has shared a really helpful post with highlights from an O’Reilly Media hosted course he led focusing on ‘Developing Robust Applications with Google AppSheet’. The post links to a number of other tutorials Aryan has published on how to create various AppSheet based applications including an Expense Tracking App, Vehicle Inspection App, Inventory Management App and more. Aryan touches on how Google Apps Script can be used in combination with AppSheet. If this is a topic you are interested in Chanel Greco recently highlighted a Google I/O session on the topic.
Remove a users edit access to a Google Drive file via an Apps Script Web App.
Web App code sample
The following Google Apps Script is designed to remove a person’s edit access from a Google Drive file via a Web App. The reason for using a Web App in this instance is because removing a person’s access to a file whilst they are running Apps Script code typically results in an error (or most certainly the inability to cleanly end the code). In the project I was working on prior to this step the code needs to send some automated emails before finishing with removing the person’s access.
I use Google Apps Script to support staff and students in my job. I enjoy dabbling with creating tools to help with automation and I freely share my learning experiences on my blog, where I also have a number of useful Google Add-ons: www.pbainbridge.co.uk
A community connector with overridable config parameters to track recent Twitter trends for a query.
For the most part this connector is pretty similar to the one I’d created for visualising global stats of SendGrid user’s email statistics but with a key difference of making use of overridable config parameters — this is what gives the connector the capability to accept a query from the report directly and return/visualize the data based on a user’s input
This post from Sourabh Choraria is a useful reminder of what is possible with Data Studio Community Connectors, in this case connecting to the Twitter API v2 to visualise the tweet count for a defined search term.
The code for this connector is available from the source post and includes lots of inline comments to help you work out what is going on making it easy to modify if you have other APIs you would like to connect.
Use Google AppsScript to automatically sync your reMarkable notes via Gmail to Notion.
Not the first example I’ve seen where the lack of API’s or other suitable integrations leads someone to using their inbox as an interface to move data around. This is a nice script example for moving handwritten notes made using reMarkable to project management and note-taking service, Notion. If you are not a Notion user it would be easy to send notes to another destination like Tasks, Sheets or a different external service like Coda.
+1, the webhook approach is nice because the Coda logic stays in Coda. I think it works best when the source (Apps Script in this case) just sends along data, not caring how it’s used.
Discover how to interact with Coda webhook-based automations using Google Apps Script! In this post, we’ll explore different code patterns in both Coda’s formula language and Google Apps Script to send data contained in a Google Spreadsheet to a Coda table, and also perform other related tasks, using the new (May 2022) webhook-powered Coda automations.
For those unfamiliar with Coda:
Coda provides word-processing, spreadsheet, and database functions. It’s a canvas that blends spreadsheets, presentations, apps, and documents together. The software can integrate with third-party services like Slack and Gmail.
This post from Pablo Felip is a great opportunity to see what is possible using the new Coda webhook-powered automations. We’ve previously featured a couple of Coda/Apps Script integrations on Pulse, that have highlighted solutions using the Coda REST API and Coda Packs. This is the first we’ve seen using webhooks, which have a ‘no-code’ when/if/then setup interface. This route may provide the quick glue required for your Coda/Google Workspace integration. Pablo includes all the source code in the post as well as detailed instructions for setting up.
I quite often get called upon by clients to create Google Sheet templates that have Google Apps Script Automations bound to them. Sometimes these Google Sheets require an automated setup process to run things like gathering initial data, setting up time triggers, approving scopes connected to onEdit() or onOpen() triggers or renaming connected forms and their contents.
One of the challenges is getting new owners of the duplicated template Google Sheet to run the bound script before they dive into working on the Google Sheet. … After quite a lot of trial and error, I have devised a pretty solid approach that seems to have the most success in getting users to run through the authorisation of scopes and then run the startup script.
Scott Donald shares his approach for helping users get setup when first using a container bound script project in Google Sheets. The process has some nice features including revealing additional sheets, changing the active sheet and cell as well as removing the setup sheet. The post also highlights some useful tips and considerations as part of the user experience including the type and placement of supporting information.
While curbside pickup of recyclables is convenient, it does require you to keep track of which type of waste is picked up when: miss the biweekly paper pickup and you’ll soon find yourself stockpiling four weeks’ worth of boxes and newspapers. When [Dominic Buchstaller]’s stack of cardboard began to reach his ceiling, he decided to take action by building himself BinPal: a fridge magnet that helps you remember when to take out which bin.
At heart of the simple but effective BinPal is an ESP32 board that connects to Google Apps Script and retrieves the pickup schedule from Google Calendar. If one of four categories of waste is due for pickup, its icon is highlighted on an LCD screen.
BinPal is an entry to the 2022 Hackday Prize which uses Google Apps Script to return Google Calendar data to an IoT device. The project page for BinPal has instructions and all the files to remake, including the file for laser-cutting/engraving the front plate. Browsing the Apps Script file for the project you’ll see it is a basic web app which returns data from a named calendar. Hackday challenges are open for set dates throughout the year so there is still a chance to submit your own projects – visit hackaday.io/prize for more info.
Build an automated system that will be automatically deployed to one of the destination spreadsheets when the code is committed to the GitHub repository.
Managing code particularly in container bound projects can be a real headache for Apps Script developers. The Script REST API has made this a lot easier both is terms of managing scripts but also opening up options for different development environments, including local development using clasp and your preferred IDE.
In terms of version control there are a number of solutions Apps Script developers can now consider. The Google Apps Script GitHub Assistant Chrome Extension is a popular option as it extends the existing online Script Editor with integration with GitHub and several other Source Code Management services (GitHub Enterprise/Bitbucket/GitLab).
For developers interested in developing projects locally there is perhaps even more choice. One solution we’ve featured a couple of times in Pulse is the use of GitHub Actions:
GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.
The latest example for using GitHub Actions comes from Goran Kukurin (gorankukurin.com). Goran has shared a setup for developing code in Google Sheets with development and production versions. As well as using GitHub Actions to automatically push code to the correct Google Sheet version a shell script is used to modify the custom menu name as a useful reminder so you can see what version you are testing:
You can visit Goran’s post (linked below) for an example repo and instructions on how to setup. If you are using a UNIX based operating system it should be straightforward. If like me you are on a Windows machine there are some minor tweaks and possibly big node-gyp headaches to overcome, which I’ve highlighted below (in Goran’s website post some commands with -- are displaying as - – this GitHub repo and Medium version are ok).
Windows Tips
You are better using PowerShell rather than CMD so you don’t have to modify things like $HOME to %HOMEPATH%.
If you’ve not already got node-gyp installed the setup that worked for me on Windows 11 was:
Node 14.19.3
Python 3.10
Visual Studio Build Tools 2017
After installing with npm install -g node-gyp there are Windows specific setup instructions (don’t forget npm config set msvs_version 2017).
After creating the spreadsheets I needed to specify the directory by including src (I think this is a nit) e.g.:
mv src\.clasp.json .clasp-prd.json
To encrypt your clasp credentials you might need to install install GnuPG.
If you are running the setup build tasks in VS Code and get:
'.' is not recognized as an internal or external command
I solved this by configuring npm to use bash.exe, some other options are give in this SO answer.
Final thought
There is a lot more you could do with GitHub Actions like pushing to multiple production spreadsheets and much more. This post from Goran Kukurin is a great insight to what is possible and we look forward to seeing where other Apps Script devs go with it.
One of the great things about Google Apps Script is the way you can automate tasks. I’ve previously written about how I automate reporting and other examples like running backup processes. These usually run daily or once a month which is very straight forward to setup in Google Apps Script. If you want to run a script automatically every x number of months such as quarterly it gets a little harder. If you only want you script to run every three months … another option is to manage triggers programmatically which allows you to specify the date a function should be run again.
I’ve recently been revisiting some of my old Google Apps Script posts to do a bit of housekeeping. I thought this was a nice little snippet should you want to schedule a function to run on a time-driven trigger greater than one month. The trick used is to recursively create a time-driven trigger when the function is called. The solution comes with some caveats :)