Tuesday 28 December 2021

Change file permissions from Editor to Viewer

The following Google Apps Script is designed to change the Google Drive file permissions of a specific user from Editor to Viewer. The function actually came about when needing to end a process where a user had been editing a Google Sheet on a Shared drive that they should only then have Viewer access to. To complicate matters the Apps Script code is running as said user when it needs to reduce their own permissions.

Firstly you will need to enable the Drive API in the Script Editor by going to 'Services' > 'Drive API' > 'Add'. Next we will look to get the permission ID for the email address of the user we want to change access for:

var permissionId = Drive.Permissions.getIdForEmail('email address here').id;

Tuesday 21 December 2021

Google Add-on: Archive Sheet data

Easily move/archive a row of data from one Google Sheet (tab) to another, within the same file. If you prefer something a bit quicker than cut/paste and with less chance of human-error. It will also remember your individual preferences for each file so it is even quicker to use next time around.

This is a Google Workspace Add-on designed to work in Google Sheets via the Side Panel and is freely available for all. It is a packaged-up version of my previous Archive Sheet data post.

I will be breaking down the new skills I have acquired in future blog posts with the hope of helping you to save time if you do something similar.

Tuesday 14 December 2021

Create a new Sheet tab and format a header row

The following Google Apps Script was developed as part of a larger tool for collating file information into a specifically formatted Google Sheet. As the tool was an Add-on I needed to setup the Google Sheet file in advance so that information could be later appended to it. This code:

  • Checks if a particular named Sheet (tab) already exists within the Google Sheet file. If it does then it will delete the existing Sheet and create a brand new one.
  • Reduce the overall number of columns within the Sheet.
  • Insert 1 row of data to use as the Header row.
  • Set the Header row font size, colour, weight (bold) and horizontal/vertical alignment.
  • Set the Header row background colour, height and column widths.
Nicely formatted Header row for appending data to
Nicely formatted Header row for appending data to

Tuesday 7 December 2021

Google Add-on: Search Drive for owned files

I am happy to announce my first ever official Google Workspace Marketplace Add-on!

Search Drive for owned files - enter an email address to find all of the Google Drive files that are owned by that account and export the results into a Google Sheet for easy viewing.

This is an Editor Add-on designed to work in Google Sheets and is freely available for all. It is a packaged-up version of my previous Search Google Drive for owned files post for those interested in what most of the Apps Script code looks like.

I will be breaking down the new skills I have acquired in future blog posts with the hope of helping you to save time if you do something similar.