Logo Light

How to Build a Simple Invoice Builder with Auto-Calculating Totals

Aug 20, 2026

Bagikan

If you've ever built an invoice in a spreadsheet, you know the routine: type the product, type the price, type the quantity, then manually multiply them together. Do that for every line, then sum it all up at the bottom — and hope you didn't make a typo in the formula.

In this tutorial, we'll build a Simple Invoice Builder where adding a product line instantly calculates its subtotal, and the invoice total updates itself automatically — no formulas required.

Why this matters

An invoice is really two things at once: a list of items, and a set of numbers that depend on each other. Spreadsheets make you manage both by hand. Here, you'll set up the structure once, and the numbers take care of themselves.


Step 1: Create the Product Table

Before we can build an invoice, we need a list of products to invoice for.

First create new table hereFirst create new table here

Create new table called OrderCreate new table called Order

Add two fields: Product Name and Unit Price.

Click here to add fieldsClick here to add fields

Create new field product name and unit priceCreate new field product name and unit price


Step 2: Create the Invoice Table

Next, create an Invoice table — this represents one invoice sent to one customer.

Sidebar showing a new table being created and named InvoiceSidebar showing a new table being created and named Invoice

Add basic fields: Invoice Number and Invoice Date.

Invoice table with Invoice Number and Invoice Date fields addedInvoice table with Invoice Number and Invoice Date fields added


Step 3: Add Line Items to the Invoice Table

Here's the key part. An invoice usually has more than one product on it — but instead of manually building a separate table to hold each line, Ambisius handles this for you.

In the Invoice table, add a new column and choose Line Items as the data type.

Adding a new column in the Invoice table and selecting Line Items as the field typeAdding a new column in the Invoice table and selecting Line Items as the field type

Select Product as the table to pull items from, and add Quantity as a column to track alongside it.

Click here to add field to tracksClick here to add field to tracks

Select One to Many to pull data from Product

Pull data from productPull data from product

Select Product for the related tableSelect Product for the related table

This is the final resultThis is the final result

Click Save to confirm the your Line Items

Final result of table InvoiceFinal result of table Invoice

The final structure the Invoice tableThe final structure the Invoice table

What just happened

Behind the scenes, Ambisius automatically created the link between Invoice and Product, along with a hidden table to hold each line item. You didn't need to build or manage any of that yourself.


Step 4: Calculate the Subtotal per Item

Now let's make each line item calculate its own subtotal — unit price multiplied by quantity.

In the Invoice table, add another new column and choose Custom Logic as the data type. Describe what you want: multiply the Product's Unit Price by the Quantity from each line item.

Add Custom Logic data type hereAdd Custom Logic data type here

Describe the logic with plain sentenceDescribe the logic with plain sentence

There will be clarification that you need to confirm, making sure your intention matches system intention.

Clarification by system about the calculationClarification by system about the calculation

Click Save to confirm.

Note

Now whenever you add your data, the Total Amount will be calculated automatically


Step 5: Add Your Data

Let's put this to work. Add a few products to the Product table.

Add Product table dataAdd Product table data

Add few productsAdd few products

Now let's put everything together. Create one Invoice record, open its Line Items field, and add a few products with their quantities.

Add Invoice data hereAdd Invoice data here

Fill in the data, notice that in Invoice Items section, there is a button, click it to add items inside it.

Button to add more line itemsButton to add more line items

As you can see, you can insert more product and its quantity

Add Invoice items modalAdd Invoice items modal

Click in Product picker, and you can pick list of Products that you have entered, no need to manual input.

Product pickerProduct picker

add one record: Laptop Stand (Unit Price $45) and its Quantity 2

Fill in Laptop StandFill in Laptop Stand

Also add one more record: Noise Cancelling (Unit Price $150) and its quantity 1

Fill in Noise CancellingFill in Noise Cancelling

This is the final invoice

Final invoiceFinal invoice

Watch the Invoice's Total amount update immediately to reflect it.
Calculation (45$ x 2) + ($150 x 1) = $240 in total

Total amount updatedTotal amount updated

The wow moment

Add a product line, and everything updates itself instantly — the and the invoice total. No re-typing a formula, no dragging a cell down, no risk of forgetting to update the sum.


Recap: What You Built

Across these steps, you created:

  1. A Product table to store items and their prices
  2. An Invoice table to represent each invoice
  3. A Line Items field connecting Invoice and Product, letting you add multiple products per invoice without building anything extra
  4. A Custom Logic field calculating total amount automatically
  5. Real invoice data, calculating itself the moment you added it
What you had beforeWhat you have now
Manually summing all rows for the totalTotal updates instantly as items are added
Risk of formula errors when copying cellsNo formulas to write or break

Try it yourself

This exact setup is available as a ready-made template. Duplicate it, explore it live, and make it yours with just few clicks.

Coba Langsung

Halaman ini

Artikel terkait

Jelajahi lebih banyak artikel produk dan praktik terbaik untuk tim yang membangun dengan Ambisius.

Masih Pakai Spreadsheet?
Wajib Coba Ini.

Ubah spreadsheet yang biasa digunakan menjadi sistem terstruktur yang dibangun untuk bisnis Anda

Coba Ambisius Gratis

Tanpa komitmen. Tanpa kartu kredit.

Logo Light

© 2026 Ambisius. Seluruh hak cipta dilindungi.