Hey! Some weeks ago I built a super simple, yet very very powerful automation, for helping a friend parse invoices, and thought it would be helpful for others to post a basic guide (and open the discussion for improvements) here.

Proof of Concept:
-
By uploading an Invoice to Airtable.
-
An automation would use AI to extract, Invoice Line Item Descriptions, Quantity and Totals.
-
Then the automation would create the corresponding records with precise information.
-
Therefore my friend can now get all insights from the invoices his company receives (how much they’re spending, what they’re spending on, and a clear picture of overall finances).
Needs:
- Airtable paid plan for scripting and AI features.
Areas of improvement:
- Prompt for AI, as well as Json output would need some iterations to allow handling multiple different invoice formats.
- Prompt for AI should include an example Json.
- Many others for sure
High-level setup:
- Invoices Table
- Invoice Line Items table
Automation:

- Triggers when attachment field in Invoices table is not empty
- AI block prompt: “ {Attachment} contains an invoice. Within it you'll find invoice line items. Each line item will have (i) Description; (ii) Quantity; and (iii) Amount. Please output a json with list of each invoice and each value. Do not output any thing different to the json”
- Script:
// Retrieve the configuration inputs from the automation let config = input.config(); let invoiceJson = config.invoiceJson; let recordID = config.recordID; // If invoiceJson is passed as a string, parse it into an object if (typeof invoiceJson === "string") { try { invoiceJson = JSON.parse(invoiceJson); } catch (error) { throw new Error("Failed to parse invoiceJson: " + error.message); } } // If invoiceJson is not an array, check if it's an object with an "invoices" key that is an array if (!Array.isArray(invoiceJson)) { if (invoiceJson.invoices && Array.isArray(invoiceJson.invoices)) { invoiceJson = invoiceJson.invoices; } else { throw new Error("invoiceJson is not an array or does not contain an 'invoices' array."); } } // Build an array of line item objects from the invoiceJson data let lineItems = invoiceJson.map(item => ({ "Description": item.description, "Quantity": item.quantity, "Amount": item.amount, // If you need to pass the invoice record ID along, include it as needed. "Invoice": recordID })); // Output the list of line items so subsequent steps can access it output.set("lineItems", lineItems);
- Repeating group with Create Record block, for creating records in Line Items table, mapping values from each line item output of the script.
Video going through it.
What other use cases could this apply to? How could this be further improved? Do you have similar workflows in place?
Happy to discuss the above!
Mike, Consultant @ Automatic Nation