Best answer

How to save PDF version and replace existing files in Google Drive?

  • 20 February 2022
  • 2 replies
  • 423 views

Hi, I’ve got questions about how to do 2 different things in Google drive:

  1. I’m generating a Google Doc from a template, and this part I have working fine. However, what I really want is to generate a PDF from the template. I know that I can just use a different URL for the resulting document to get a PDF version of the Google Doc, but how do I actually save the PDF version of the file into the same Google drive folder?
  2. I occasionally recreate one of the Google Docs to incorporate changes to the template, and in the situation where the result doc already exists (same file name), I want the new file to simply overwrite the previous file, as one would expect to happen. However, what happens instead is that a new file is created with the same name, and then BOTH files are in the folder, which is stupid. Is there a way to check if the file already exists and delete it first? I don’t see any “delete” action on the Google connectors.

Thanks for any help!

/mike

icon

Best answer by Troy Tessalone 20 February 2022, 02:41

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +14

Hi @mikegriefkey 

For #1, you’d need to use a Zap action: GDrive Upload File (and map the PDF version of the generated GDoc)

 

For #2, try these Zap steps:

 

Okay, I was able to more or less accomplish what I wanted for #1 and #2 using only your last 2 suggested steps. Since I know what my target PDF is going to be called, I use Find or Create File to either locate an existing one or create a new one with that name. Then I generate the PDF from the original Google Doc as part of the Replace File step and replace the file from the first step with this one. Because the PDF can be generated during that second step, I don’t need to use Upload File to generate the PDF first.

Thanks for the tip!

/mike