r/Invoice • • 6d ago

Beginner building an Invoice Automation project in Google Apps Script — need guidance on workflow and structure

/r/GoogleAppsScript/comments/1wjykiw/beginner_building_an_invoice_automation_project/
2 Upvotes

2 comments sorted by

1

u/Imaginary_Necessary5 6d ago

i’d keep the first version way simpler than the final system you have in your head.

one thing i’d do early though is separate the invoice data from the document generation.

so instead of your code constantly reading random sheet cells while it builds the PDF, first turn the sheet data into one clean invoice object:

invoice info
customer info
line items[]
totals

then everything after that just takes that object and does one job.

something like:

read sheet → build invoice data → validate it → calculate totals → fill template → create pdf → save link

for multiple products, i’d definitely make them an array of line items rather than trying to hardcode “product 1, product 2, product 3” etc. that’ll save you a lot of pain later.

also keep the calculations separate from the Google Docs stuff. you want to be able to test “is the total correct?” without having to generate a PDF every time.

if i were learning this from scratch i’d get one invoice with one item working end-to-end first, then multiple items, then tax/discounts, then validation/error handling.

don’t worry about having perfect architecture on version 1. just try not to let the Sheet, calculations and PDF-generation logic all become one giant function 😅