Bulk convert all the Google Docs within a given folder to PDFs and optionally delete the Docs afterwards. Specify the destination folder for the PDFs.
The following Google Apps Script tool is designed to bulk convert all Google Docs 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 Docs to be deleted. This tool does work on Shared drives.
Source: The Gift of Script: Bulk convert Google Docs to PDFs
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: www.pbainbridge.co.uk
Any way to get this to do both Google Docs and DOCX files within google drive?
I tried changing line 46 Mime type from GOOGLE_DOCS to MICROSOFT_WORD and got this error in the logs: Error during file iteration/conversion: Exception: Conversion from application/vnd.openxmlformats-officedocument.wordprocessingml.document to application/pdf failed.
Great work with this script!!!
I’ve replied to your original comment on my blog: https://www.pbainbridge.co.uk/2021/09/bulk-convert-google-docs-to-pdfs.html?showComment=1652302493217#c6290533259193188667
But below is a copy of my response too:
Thank you Elvy
I’m not currently aware of a way to directly convert Microsoft Word files to PDF. Work I’ve done with native Microsoft files has involved needing to convert them to their Google-equivalent first, before working on them.
My latest blog post (https://www.pbainbridge.co.uk/2022/05/bulk-convert-excel-files-to-google.html) is an example of this with Excel files. My initial thoughts are whether you could tweak this MimeType to GOOGLE_DOCS and then stick the PDF converter on it … ?