AppsScriptPulse

Use a Google Sheets as a database in Google Apps Script without sharing it

Make Google Sheets as your database for your web app or add-on developed in Apps Script without sharing the file. … In order to keep our database secret to end users we will use a Service Account (SA) … This Service Account is not a real account, no Gmail or Drive attached but a service account can access a spreadsheet. We will use this property to manage our data.

As the post author Stéphane Giron indicates before using Google Sheets as a database you need to fully scope out if it’s the right solution for you. For ‘small’ data you can often get away with using Sheets and in this post from Stéphane you can learn how to do it in a way where you can have access control by setting up and using a Service Account.

Source: Use a Google Sheets as a database in Apps Script without sharing it

How to remove a Google Sheets button (drawings) or images connected to a Google Apps Script after the script has been run – Yagisanatode

There have been a few instances in my work where I need to remove a button (more accurately, a button drawing) or and image from a Google Sheets tab once the associated script has been run.

Perhaps we just want the user to run a process on a Google Sheet workbook, just once but not more times. This would be a good case for removing the button or drawing after use.

Note: This tutorial expects that you know how to create a drawing or a button from the Google Sheets drawing tool. 

Some clever Google Sheets pseudo button manipulation shown off here by Scott Donald. If using Apps Script functions assigned to drawings and images is something you are interested by sure to also check out Kanshi Tanaike’s example of ‘Using Google Apps Script to disable custom functions assigned to Google Sheets buttons/images to prevent simultaneous execution‘.

Source: How to remove a Google Sheets button (drawings) or images connected to a Google Apps Script after the script has been run – Yagisanatode

Using spread syntax and destructuring assignment in Google Sheets .getValues() with Google Apps Script

In this report, I would like to introduce to apply the spread syntax and the destructuring assignment to Google Spreadsheet with Google Apps Script. … I have sometimes gotten the questions related to the spread syntax and the destructuring assignment. So, I thought that I would like to introduce in my blog.

We’ve featured other coding patterns from Kanshi Tanaike and here is some other nice examples of how you can handle 2D arrays returned by .getValues(), in particular, this post shows a nice way of getting non-adjacent columns in Google Sheets.

Source: Applicating Spread Syntax and Destructuring assignment to Google Spreadsheet with Google Apps Script

Use Google Apps Script to pull all Google Shared Drives and permissions into Google Sheets

If you’re a Google Workspace Super Admin, you’ve probably been thinking of ways to inventory and keep a handle on Google Shared Drives. They are a really great addition to the Workspace offering, but there are still some gaps in reporting & oversight that some people have wanted. This solution uses Google Apps Script and the Drive API to pull information about all the Shared Drives in a domain into a Google Sheet. Then, it uses the Drive API again to loop through all the drives and get the top-level permissions.

For Google Workspace admins Nick Young has provided a nice solution for auditing Google Shared Drives within your Workspace domain. This post covers all the steps to setup, a link to the code on GitHub and some notes on limitations to be aware of.

Source: Use Apps Script to pull all Google Shared Drives and permissions into a Google Sheet

Search Google Drive folders for creation/modified dates using Google Apps Script

Search one level of Google Drive folders and extract creation, last updated and folder names into a Google Sheet.

Enter the Parent folder ID and search the folders within

Enter the Parent folder ID and search the folders within

The following Google Apps Script is designed to search through one level of Google Drive folders and extract the following information into a Google Sheet:

  • The folder name as a direct clickable link,
  • The folder creation date,
  • The folder last updated date,
  • The folder ID.

Source: The Gift of Script: Search Google Drive folders for creation/modified dates

NEW! Calling Google Apps Script from an automation in #AppSheet

Add custom integrations to your app using Apps Script. … You can use custom logic from within your AppSheet app by calling Apps Script from an AppSheet automation bot.

Examples of custom logic that you can implement include:

  • Create a calendar appointment when a button is clicked
  • Add a slide to a presentation when a new row is added
  • Save photos to Drive and share with specific individuals when uploaded using a form
  • Create an audit log by generating a Google Docs file with data from a table
  • Call an external service for machine learning prediction using data from a newly added row and write back model prediction

If you are not familiar with AppSheet it’s Google Cloud’s no-code platform that allows users to create custom applications that can be deployed across mobile and web, often setup using Google Sheets as a data source. AppSheet can be customised with workflows and automations, and those automations have recently been extended with a new preview integration to Google Apps Script.  The video in the Call Apps Script from an automation page provides a great summary of how the Apps Script integration works.

Source: Call Apps Script from an automation

Create multiple labels in Gmail with Google Apps Script

With this reusable script you can create multiple labels in Gmail whenever you need to do so. All you have to do is create the script as shown in the video and then use it to create multiple Gmail labels in one go.

Continuing the Gmail label theme in this latest video tutorial from Chanel Greco you can learn how to batch create Gmail labels from data in a Google Sheet.

Creating a ‘full fat’ RSS feed for Google Gmail labels with Google Apps Script

In this post I want to cover three things. First I want to introduce a little app I’ve developed which allows you to create a RSS feed for any of your Gmail labels (with the option to remove certain links – useful if you don’t want others unsubscribing you from mailing lists). Secondly I explain how it was made and how you can use it yourself. Finally I want to discuss how this could be used in an open course environment, utilising the vast processing power from services like Twitter and reusing their target marketing emails to your benefit with a bit of ‘dark social judo’.

This solution was first published in May 2013 and since then Google Apps Script has evolved deprecating services that originally made this solution possible, in particular, ScriptDB and the original XML service which includes a handy .parseJS() method.

Following a request I’ve recently updated the solution to make it work again. As well as swapping out ScriptDB in favor of using the Properties Service I used the makeRSS method previously highlighted here in Apps Script Pulse.

Source: Creating a ‘full fat’ RSS feed for Google Gmail labels (enabling some dark social judo)

How to import PayPal transactions into Google Sheets with Google Apps Script – Digital Inspiration

Learn how to easy import transactions from PayPal into Google Sheets with Google Apps Script. You can import standard transactions, recurring subscriptions and donations.

Even if you aren’t interested in PayPal this post is well worth looking at as the author, Amit Agarwal, is a master when it comes to handling data with Google Apps Script and there is a general patterns of ‘get data from an API, write it to a Google Sheet’ that might be useful for your own projects.

Source: How to Import PayPal Transactions into Google Sheets – Digital Inspiration

How to Build an API Wrapper in Google Apps Script

No Google Apps Script SDK for your favorite API? No problem!

I’ve never seen a Google Apps Script SDK made available as part of an API, as, surprise surprise, it’s not the most popular choice for professional development. It’s time to start changing that, so we will learn to build our own!

[Editor note: Really impressive work from Dmitry providing a framework you can use to develop your own service for interacting with 3rd party APIs. The post includes lots of clear instructions and guidance to help you understand and learn about approaches for structuring your Google Apps Script code projects]

Source: How to Build an API Wrapper in Google Apps Script