AppsScriptPulse

Bulk convert Google Docs to PDFs

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.

Bulk convert Google Docs to PDFs using Apps Script

Bulk convert Google Docs to PDFs using Apps Script

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

2 comments for “Bulk convert Google Docs to PDFs

  1. Elvy Gerez
    11 May, 2022 at 20:0721

    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!!!

  2. Phil Bainbridge
    12 May, 2022 at 19:1021

    Hi Elvy

    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 … ?

    Kind regards
    Phil

Leave a Reply

Your email address will not be published. Required fields are marked *