
Now the document opens up as a PDF in the browser. That’s all well in good, but what if you want to view the pdf inline without downloading the pdf? That’s where Google’s online viewer app comes in. Now the link will download a pdf of the document. Remove edit?usp=sharing and replace it with export?format=pdf. For example, the link will look something like this: But this document shows up in Google Docs, what if you want to give others a link to a PDF instead? Change the end of the link to export?format=pdf and remove the edit stuff. You then get a link to the Google Doc that others can use to view the document. Go to Sharing on the Google Doc, either click on Public on the web or Anyone with the link, depending on your comfort level of others finding your document.


Var file = DriveApp.getFileById( 'ENTER ID HERE')

Var folder = DriveApp.getFolderById( 'ENTER ID HERE')

This snippet of code is from larger solutions developed on this blog and allows you to understand and replicate the process.įirstly we get our Google Doc (that we want to convert to a PDF) and the Google Drive folder where we want our PDF to be stored: The following Google Apps Script is designed to create a PDF file of a Google Doc in a Drive folder that you specify, with the option to delete the original Doc. As of February 2023 'Convert Drive Files' is now available as a Google Workspace Marketplace Add-on.
