Creating Bulk PDF's From Google Sheets Data

173 views
Skip to first unread message

Andrew Booth

unread,
Jul 7, 2023, 9:14:31 PM7/7/23
to Google Apps Script Community
I am working on creating letter format PDF documents for multiple rows of data in google sheets. I've already gotten the script to find and replace the doc template { } with correct words from the sheet then create the template in the TEMP folder. The issue i'm having is its not turning that template into a PDF into my PDFS folder. I've double checked my ID's they are correct. Im thinking my issue is with the .getAs(MimeType.PDF). Any insight from anyone? Would be greatly appreciated.

 
Screenshot 2023-07-07 at 9.13.31 PM.png

Scott Bennett

unread,
Jul 7, 2023, 9:28:46 PM7/7/23
to google-apps-sc...@googlegroups.com
I am not at my computer right now, but I was able to find some thing that might help. 
Take a look, how the code grabs the file here



Scott Bennett


Sent from my iPhone 

On Jul 7, 2023, at 8:14 PM, Andrew Booth <drewb...@gmail.com> wrote:

I am working on creating letter format PDF documents for multiple rows of data in google sheets. I've already gotten the script to find and replace the doc template { } with correct words from the sheet then create the template in the TEMP folder. The issue i'm having is its not turning that template into a PDF into my PDFS folder. I've double checked my ID's they are correct. Im thinking my issue is with the .getAs(MimeType.PDF). Any insight from anyone? Would be greatly appreciated.

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f2889195-0669-4bbc-a562-34b58f246293n%40googlegroups.com.
<Screenshot 2023-07-07 at 9.13.31 PM.png>

Andrew Booth

unread,
Jul 10, 2023, 11:11:20 AM7/10/23
to Google Apps Script Community
Hey Scott, thanks for the reply.
I'm not finding a fix with that code. It seems the script is not getting past the pdfContentBlob but it is handling the .closeandsave for the Temp file.

Bennett, Scott

unread,
Jul 10, 2023, 2:20:30 PM7/10/23
to google-apps-sc...@googlegroups.com
This is code that I use I grab the file with the Drive App
  let blob = DriveApp.getFileById(fileID).getAs('application/pdf');
  let fileID = folder.createFile(blob).setName(title+' - '+name+'  '+dates).getId(); //creates pdf file from doc template
  let fileURL = DriveApp.getFileById(fileID).getUrl()


On Fri, Jul 7, 2023 at 8:14 PM Andrew Booth <drewb...@gmail.com> wrote:
I am working on creating letter format PDF documents for multiple rows of data in google sheets. I've already gotten the script to find and replace the doc template { } with correct words from the sheet then create the template in the TEMP folder. The issue i'm having is its not turning that template into a PDF into my PDFS folder. I've double checked my ID's they are correct. Im thinking my issue is with the .getAs(MimeType.PDF). Any insight from anyone? Would be greatly appreciated.

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f2889195-0669-4bbc-a562-34b58f246293n%40googlegroups.com.


--
Scott Bennett
Data and Assessment Coordinator/Math Teacher
Bradley-Bourbonnais Community High School

Reply all
Reply to author
Forward
0 new messages