📝 Overview
This example introduces how to automate invoice generation and distribution using a spreadsheet-based invoice template. The system retrieves invoice details from a database, processes them into a PDF invoice, and emails them to multiple target companies.
📌 In this guide, invoices are generated as PDFs. If you want to exclude specific sheets from the final PDF, hide them in the spreadsheet before running the process.
🛠️ Features and Tools Used
✔️ YoomDB – Stores customer and invoice data
✔️ Schedule Trigger – Initiates the Flowbot automatically at a set date and time
✔️ Database Operation – Retrieves invoice records
✔️ Data manipulation - Adjust date settings to process the previous month's usage
✔️ Loop command - Iterates through multiple invoice records one by one
✔️ Spreadsheet App – Prepares and processes invoice details
✔️ Document Generation – Converts invoices into PDFs
✔️ Email Operation – Sends the invoices via email
🔍 How It Works
Database Setup
This workflow relies on two YoomDB:
Customer Master – Stores company details, email addresses, and a billing flag that determines whether an invoice should be sent.
Invoice Master – Contains invoice details such as product name, unit price, billing month, and the company name being billed.
This system automatically sends invoices for the previous month’s usage only to companies with billing flags enabled in the Customer Master database.
Step-by-Step Process
1️⃣ Trigger Activation
The Flowbot starts at a predefined date and time using a schedule trigger.
2️⃣ Retrieve Invoice Targets
The system scans YoomDB for companies with billing enabled and extracts the relevant records.
3️⃣ Check for Target Companies
If no companies match the criteria, the workflow ends.
4️⃣ Adjust the Invoice Date
The system subtracts one month from the current date to ensure invoices reflect the previous month’s usage.
5️⃣ Loop Through Each Record
Since multiple companies require invoices, a loop command ensures they are processed one by one.
6️⃣ Retrieve Customer Details
The Flowbot pulls the company’s details from the Customer Master.
7️⃣ Retrieve Invoice Details
It then fetches the company’s invoice records from the Invoice Master.
8️⃣ Prepare the Invoice in a Spreadsheet
The invoice data is entered into a spreadsheet template for processing.
9️⃣ Generate a PDF Invoice
The invoice is converted into a PDF.
At this stage, any unnecessary sheets are automatically hidden before the final document is created.
🔟 Send the Invoice via Email
The PDF invoice is attached to an email and sent to the company.
🚀 Try It Yourself
Use the Pre-Built Flowbot Template - Click Here to Try It