
Email-to-Booklet: Parse, Personalize, and Merge Legal PDFs with n8n + PDF.co
6 MIN READ
A fully automated system that watches a Google Sheet for new webpage entries, converts each listed webpage to PDF via PDF.co, and then routes the generated PDF to the correct Google Drive folder based on its category (legal, docs, or blog). Each PDF is neatly named from your sheet’s Slug field and saved in the matching Drive folder for instant access and archiving.
Before you begin, make sure you have:
Quick Start Options
Follow the detailed 5-step guide below.
The workflow triggers automatically whenever a new row is added to your sheet, passing the row’s details (URL, Page Name, Slug, Section, etc.) downstream.
Google Sheets Trigger
Settings/Value
1c3SGw-ndxVdUosIopB3E32Cqlku2enGdcwRfbY9eAnQ)Success Looks Like:
As soon as you add a new row, the workflow fires with all the sheet columns available as JSON fields.
We use a small JavaScript “Code” node to read the Section column (e.g. docs, legal, blog) and attach the correct Drive folder ID so the Upload node knows where to save the PDF.
Code
// Map each Section name to its Google Drive folder ID
const map = {
legal: '1CpeZggbkVKp-mT1_QKPKs5k7KerxV7BL',
blog: '1vB02cTyzypNgL2xDzuHpfDGfEvo-T4y0',
docs: '1EPuJSQV7aAfaZtdf_81toJrn8_AUAWdf',
};
// Normalize text (trim + lowercase)
function normSection(val) {
return String(val ?? '')
.trim()
.toLowerCase();
}
// Loop through incoming items
return items.map(it => {
const raw = it.json.Section ?? it.json.section;
const section = normSection(raw);
it.json.driveFolderId = map[section] || map.legal; // default fallback
it.json._sectionRaw = raw; // debug info
it.json._sectionNorm = section; // debug info
return it;
});What This Code Does
map linking each category to its Drive folder ID.driveFolderId to each item for the next node.Success Looks Like:
Every incoming item now carries driveFolderId = the correct folder ID for its section.
What happens: We ask PDF.co to render the webpage into a PDF. PDF.co returns a temporary URL to the generated file (not binary yet).
Node: PDF.co App (native) → Operation: URL/HTML to PDF
={{ $json.URL }}={{ $json.Slug }}={{ $json.Orientation || "Portrait" }}This calls PDF.co API → PDF from URL behind the scenes.
What happens: We take the url from the PDF.co node and download it so we have a binary file to upload to Drive.
Node: HTTP Request
={{ $json.url }}dataFile Name: ={{ $json.Slug }}.pdf
Success looks like: The node now outputs a binary property named data which contains the PDF bytes (ready for upload).
What happens: We upload the binary PDF produced by the HTTP node into the mapped Drive folder (driveFolderId), keeping your naming scheme.
Node: Google Drive → Upload File
data={{ $json.Slug }}.pdf={{ $json.driveFolderId }}What This Does: Uploads each generated PDF to its respective folder:
site-archive/legal/site-archive/docs/site-archive/blog/Success Looks Like: Within seconds, the PDF appears inside the correct Drive folder.
Columns and Expressions
={{$json["webViewLink"]}}"Success"This gives you instant visibility right inside your sheet.
You’ve built a hands-off system that turns webpage URLs from Google Sheets into properly filed PDF archives in Google Drive — categorized by section automatically.
What Happens
docs and assigns the Drive folder ID 1EPuJSQV7aAfaZtdf_81toJrn8_AUAWdf.Google Drive uploads the file as: mdn-js-guide.pdf
site-archive/docs/Check your Drive folder — the PDF is there instantly!
Share your automation success with the community and tag @pdfdotco — we love seeing creative n8n + PDF.co workflows!

6 MIN READ

6 MIN READ

6 MIN READ

6 MIN READ
Create an account, get an API key and test a request.