If your organisation is using Google Workspace Business Standard, Business Plus, Enterprise, or one of the other supported plans, you are likely taking advantage of the power of Google’s Shared Drives.
If you have decided to create a Google Apps Script project that needs to get a list of your Shared Drive (or a user’s shared drives in the case of a WebApp), then you might be scratching your head right now wondering how to get this list using the built-in DriveApp class.
Whelp, unfortunately, at the time of writing this article the DriveApp class does not have this functionality. However, it is pretty easy to access in a single line of code using an Advance API.
Ah, bureaucracy at its finest. Have you ever asked for a list from a client, another department or agency and instead of saving into a file that might even be considered marginally useful, they give it to you as a pdf. A… p…d…f.
After some prostrations to the great Google Apps Script gods, I had a though.
“Hey, can’t we convert a PDF to a Google Doc with just a click of the button? Surely the great Google Apps Script devs have made it so we can do it programmatically too.”
And you know what? They bloody well did. The big legends.
Table of Contents
I’ve just received a bunch of PDFs. The PFDs are all labelled by the class number. Take a look at the files in my Google Drive:
Each PDF file contains a list of student IDs that I need to extract and put into a Google Sheet.
The aim is to have a list of student IDs in column A and their corresponding sections in column B.
As you can see, we have some pretty standard text in the PDF that should be easy for Google to recognise so that we can extract the IDs.
The list of names in the demo sheets were randomly generated by AI!
NOTE! As always, I have tried to create this tutorial for varying levels. Feel free to follow along, or just grab what you need and get stuck into your own project.
If you are playing along, you can find a copy of the PDF files below. Simply add them to your own Drive before you get started: