Managing invoices manually every month is time-consuming and error-prone. Many businesses using Zoho Books download invoice PDFs and upload them manually into Zoho WorkDrive folders for accounting, audit, or compliance purposes.
But what if this entire process could be automated?
In this guide, you will learn how to automatically:
- Generate invoice PDF from Zoho Books
- Check if a monthly folder (e.g., March-2026) exists in Zoho WorkDrive
- Create the folder if it does not exist
- Upload the invoice PDF to the correct monthly folder automatically
This solution is built using Zoho Deluge, Zoho Books API, and Zoho WorkDrive API.
Why Businesses Need This Automation In Zoho Books
Common Manual Process
- Generate invoice
- Download PDF
- Create monthly folder (if not exists)
- Upload invoice manually
- Rename file correctly
- Organize for accounting
This creates problems:
- Time waste
- Folder inconsistency
- Missing invoices
- Audit difficulties
- Human errors
Final Output of This Automation
After invoice creation in Zoho Books:
- The system automatically generates invoice PDF
- It checks for current month folder (e.g., February-2026)
- If folder exists → upload PDF
- If not → create folder → then upload PDF
- File name = Invoice Number.pdf
- Files are organized month-wise automatically
Result: Clean, structured, automated invoice storage in WorkDrive.
Step-by-Step: How the Function Works
Let’s break down the core logic of your Deluge function.
Step 1: Get Invoice ID and Number
invoiceID = invoice.get("invoice_id");
getInvoiceNumber = invoice.get("invoice_number");
This retrieves:
- Unique invoice ID
- Invoice number for file naming
Step 2: Generate Invoice PDF from Zoho Books
getInvoicePDF = invokeurl
[
url :"https://www.zohoapis.com/books/v3/invoices/print?organization_id=XXXX&invoice_ids=" + invoiceID
type :GET
connection:"<Connection_Name>"
];
This uses the Zoho Books Print API to:
- Generate invoice PDF dynamically
- Fetch it directly inside Deluge
Then:
getInvoicePDF.setFileName(getInvoiceNumber + ".pdf");
getFileName = getInvoicePDF.getPrefix(".pdf");
The file is renamed as:
INV-00045.pdf
Step 3: Generate Monthly Folder Name Automatically
monthList = {"1":"January","2":"February","3":"March","4":"April","5":"May","6":"June","7":"July","8":"August","9":"September","10":"October","11":"November","12":"December"};
currentMonthNumber = zoho.currentdate.getMonth().toString();
currentYear = zoho.currentdate.getYear();
generateFolderName = monthList.get(currentMonthNumber) + "-" + currentYear;
Example output:
February-2026
This ensures structured, chronological storage.
Step 4: Search Folder in Zoho WorkDrive
getAllFolders = invokeurl
[
url :"https://www.zohoapis.com/workdrive/api/v1/teams/{team_id}/records?search%5Bname%5D=" + generateFolderName + "&filter%5BparentId%5D={parent_id}"
type :GET
connection:"<Connection_Name>"
];
This checks:
- If the monthly folder already exists
- Inside a specific parent directory
Step 5A: If Folder Exists → Upload Invoice
fileUpload = List();
fileUpload.add({"paramName":"filename","content":getFileName + ".pdf","stringPart":"true"});
fileUpload.add({"paramName":"override-name-exist","content":"true","stringPart":"true"});
fileUpload.add({"paramName":"content","content":getInvoicePDF,"stringPart":"false"});
fileUpload.add({"paramName":"parent_id","content":"{folder_id}","stringPart":"true"});
uploadFile = invokeurl
[
url :"https://www.zohoapis.com/workdrive/api/v1/upload"
type :POST
files:fileUpload
connection:"<Connection_Name>"
];
Invoice is uploaded directly into existing folder.
Step 5B: If Folder Does Not Exist → Create Folder + Upload
data = Map();
dataParam1 = Map();
attParam1 = Map();
attParam1.put("name",generateFolderName );
attParam1.put("parent_id","{parent_id}");
dataParam1.put("attributes",attParam1);
dataParam1.put("type","files");
data.put("data",dataParam1);
createFolder = invokeurl
[
url :"https://www.zohoapis.com/workdrive/api/v1/files"
type :POST
parameters:data.toString()
connection:"<Connection_Name>"
];
Then upload PDF into the newly created folder.
Real Business Use Case
Case: Accounting Firm Managing 500+ Invoices Monthly
Before automation:
- 3–4 hours per week organizing invoices
- Folder mistakes
- Audit issues
After automation:
- 100% automatic filing
- Perfect month-wise organization
- Faster audit preparation
- Zero manual intervention
Benefits of Zoho Books + Zoho WorkDrive Automation
| Feature | Benefit |
|---|---|
| Automatic folder creation | No missing folders |
| Auto PDF generation | No manual downloads |
| Structured naming | Clean document management |
| Cross-app integration | Seamless Zoho ecosystem |
| Audit-ready storage | Faster compliance process |
Best Practices for Implementation
- Use OAuth connections (not hardcoded tokens)
- Keep parent folder fixed for structure
- Use consistent month format (Month-Year)
- Log upload responses for debugging
- Add error handling for API failures
- Consider storing WorkDrive folder ID in a custom field for performance optimization
When Should You Use This?
You should implement this if:
- You generate 50+ invoices per month
- You store invoices externally for compliance
- Your accountant needs structured access
- You want zero manual file handling
- You are scaling your business
Advanced Improvements (Optional Enhancements)
You can extend this solution by:
- Creating Customer-wise subfolders
- Creating Year → Month hierarchy
- Auto-sharing folder with Accountant
- Sending email notification after upload
- Storing WorkDrive link back in Zoho Books custom field
- Triggering via Workflow when invoice status = Paid
Frequently Asked Questions (FAQ)
Can this run automatically when an invoice is created?
Does this work for EU, US, and IN data centers?
Can I store files in customer-specific folders?
Is this secure?
Can this be extended to Bills or Credit Notes?
Conclusion
This automation transforms invoice management inside Zoho One. By connecting Zoho Books and Zoho WorkDrive using Deluge and APIs, businesses can eliminate manual document handling completely.
If you are scaling your operations and want structured, automated document storage inside Zoho ecosystem, this solution is highly recommended.
👉 Read More:



