Tuesday, 22 November 2022

Filter a try/catch error message

The following Google Apps Script is designed to exercise how you might go about searching the error message in a 'try/catch' for keywords. I wanted this specifically for a tool I built that contains a lot of code (and hence a lot of potential error messages) between a try/catch, for which a very small number of people were experiencing a timezone issue with their Google Sheet file.

The aim was to use a JavaScript 'match' to find the keyword timezone and display a set of instructions for the user to resolve the issue themselves instead of just a generic error message. The below Apps Script code is a simplified version of all of that aimed at just getting a file and using a typo in the code to trigger an error.

Filter an error message in a try/catch
Filter an error message in a try/catch

Tuesday, 8 November 2022

Bulk convert Google Sheets to PDFs

As of February 2023 'Convert Drive Files' is now available as a Google Workspace Marketplace Add-on.

The following Google Apps Script tool is designed to bulk convert all Google Sheets (only) within a given Google Drive folder into PDFs. You can choose the destination folder for the PDFs to be put into and also whether you want the original Sheets to be deleted.

Bulk convert Google Sheets to PDFs using Apps Script
Bulk convert Google Sheets to PDFs using Apps Script

Tuesday, 11 October 2022

Import CSV data into Google Sheet files

The following Google Apps Script is designed to loop through a folder of CSV files in Google Drive, extract the data, create a Google Sheet file per CSV, and insert the data into specific rows/columns.

CSV File template to copy data into
CSV File template to copy data into

Tuesday, 27 September 2022

Get Qualtrics Survey details

The following Google Apps Script is designed to connect to the Qualtrics API for getting the details of a Survey with a given ID, such as its name and the questions.

Qualtrics API Survey details
Qualtrics API Survey details

Tuesday, 13 September 2022

Search Google Drive for Shared with me

The following Google Apps Script is designed to search Google Drive for all of the files found in the 'Shared with me' space. It will collate this information into a Google Sheet, including:

  • The file name as a direct clickable link,
  • The file ID,
  • The type of file eg PDF, Google Sheet/Doc,
  • The file creation date,
  • The file last updated date,
  • The folder path,
  • The file owner.
Search Google Drive 'Shared with me' and collate the results
Search Google Drive 'Shared with me' and collate the results

Tuesday, 30 August 2022

Bulk export Qualtrics survey results 2.0

The following tool is designed to connect to your Qualtrics account and export the results data for multiple surveys that you specify, in one go. The results will be appended to the Google Sheet using the survey-name to identify each sheet of data. The data itself is exported as CSV.

This post is an updated version of the previous tool that has become redundant due to changes in the Qualtrics API.

Screenshot of instructional sheet requesting Qualtrics information
Screenshot of instructional sheet requesting Qualtrics information

Tuesday, 16 August 2022

Autofill Google Sheet Formula

The following Google Apps Script is designed to insert a formula into the first row of data in a Google Sheet, then use Autofill to add the formula to the subsequent rows below. In this example I am just using a simple Sum formula to add up age and shoesize for demo purposes. The need to do this came about when combining multiple Google Sheet files however, that needed calculations adding to the final composed version.

Autofill Google Sheet Formula
Autofill Google Sheet Formula

Tuesday, 19 July 2022

Move Column Positions

The following Google Apps Script is designed to reposition 2 columns within a Google Sheet. It is a small and simple bit of code but it was something new to me when I was collating lots of files together and appending columns at the end - which then needed to be moved.

In this example I am moving columns 'collegename' (E) and 'shoesize' (F) to the left of 'postcode' (D). So that 'postcode' will be the final column (F).

Move columns in a Google Sheet
Move columns in a Google Sheet