Tuesday, 7 September 2021

Bulk convert Google Docs to 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.

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


Use the 'Welcome' sheet to complete the necessary information before proceeding. All of the Google Docs need to be in the same folder. Either use the Start button or the Admin menu to start the process.

Toast notifications will appear at the bottom right of the Google Sheet to inform you of the progress. The Log sheet can be used to diagnose any problems you encounter.

The new PDFs will use the same filename as the Google Docs. You can use the dropdown on the Welcome sheet to decide if you want to delete the original Docs - selecting 'No' or leaving it blank will not delete the Docs.


Bulk convert Google Docs to PDFs download here (please use 'File' > 'Make a copy' for your own version).


  1. Hi! Thank you for such a fantastic tool! Your video walkthrough helped me troubleshoot locating the file ID! I am currently running an issue where the toast box claims "Tax has successfully completed" yet no files have been converted or placed into the destination file. Do you have any ideas of what I can do to get the files in the destination folder? Thanks again!

    1. Hi Carrie

      Sorry to hear you are having difficulties, below are a few suggestions:

      1) There is a 'Log' tab in the Google Sheet, are you able to copy/paste what is being logged in there please (it may highlight where it is getting stuck)?
      2) Have you been able to get it working at all? Have you tried creating a simple Google Drive folder and popping a single Google Doc into it and then using the tool on that?

      Kind regards

  2. Hi Phil,
    Thanks for the quick reply!
    The tutorial video was very helpful in getting started. I believe I have narrowed down the issue to shared documents. When I convert an unshared document, the script works and the document is successfully converted. When I try to convert a shared document, the textbox then reads, "Tool complete. 0 PDFs created. No errors. PDFs have been created for all Google Docs."

    The log reads as follows:
    Script has started
    Starting 'convertToPdf' Function
    Option to delete original Google Docs is: No
    Starting to convert files...
    Getting Script Properties.
    No Continuation Token exists. Converting Docs...
    Completed converting 0 Docs in folder
    Deleting Script Properties.
    Successfully deleted Script Properties.

    When I successfully convert (unshared) documents, the names are erased. That could be due to the fact that my naming system includes numbers (1.1. Document 1). Everything after the "1." disappears to look like, "1.1.pdf."

    Thanks for the help!

    1. Hi

      Thank you for providing further details.

      I'm unable to recreate the error from your suggestion unfortunately - I have a folder of Docs and if I share them individually or the folder as a whole, the conversion works perfectly fine either way.

      With regards to the naming convention - I was able to recreate that error! I have added an extra step in the code to resolve this, all you need to do is download a new copy of this tool (I have updated the link on this page).

      Kind regards

  3. Great Script!! It works great.

    I tried changing the mimetype from GOOGLE_DOCS to MICROSOFT_WORD and ran the script and got the follwing error: Error during file iteration/conversion: Exception: Conversion from application/vnd.openxmlformats-officedocument.wordprocessingml.document to application/pdf failed.

    Is there a way to make it so that it converts borth docx and google doc files?

    1. 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

  4. What can I say? I am deeply impressed
    and very grateful.
    With kind regards