A lesson is completed when you tick it, when you watch its video to the end or when you score 80% on its quiz. The certificate is issued online after the final assessment, from a score of 32 out of 40.
Lesson 33, module 9: Everyday flows Extracting data from invoices and incoming documents Eighty invoices a month, three minutes each: four hours of re-keying. Since September 2026, some already arrive as structured data. [Diagram: E-invoicing in France] 1 Sept 2026: Receiving, for all 1 Sept 2026: Issuing, large and mid-sized firms 1 Sept 2027: Issuing, SMEs and micro-businesses Timetable published by the authorities. Between the two dates, PDFs will keep arriving from your SME suppliers. The flow reads the PDF, the AI fills in the fields, the code checks. [Diagram: From attachment to approved line] 1. Document received 2. Document text 3. Fields as JSON 4. Checks 5. Approval The AI reads, the code checks, a person approves. Payment stays outside the flow. The AI copies; it doesn't calculate or guess. Prompt: Extract from this invoice: supplier, SIREN, number, date, excl. VAT, VAT, incl. VAT. Amounts as numbers, dates YYYY-MM-DD, null if missing. Response: { "fournisseur": "Négoce Atlantique", "siren": "812345676", "numero": "FA-26-1187", "date_facture": "2026-11-03", "montant_ht": 1250, "total_tva": 250, "montant_ttc": 1500 } The code recalculates what the AI read. Excl. VAT + VAT = incl. VAT, to the cent SIREN with its check digit Same number, same supplier: duplicate Paying, changing bank details, deleting: never through the flow. [Diagram: What the flow is allowed to do] Green: On its own Orange: Proposed, then approved Red: Never through the flow Our rule: in the first month, every line goes to "to approve". After three weeks with no errors, lines with no alert go through on their own. With Microsoft 365, AI Builder reads invoices too, for credits. "Extract information from invoices" action A confidence score per field No credits, and the action fails In the exercise, you build the parts-invoice flow for a garage.
Your turn: A car garage's parts invoices The written lesson, the worked exercise and the quiz are below the video.
Lesson 33 of 50 · module 9, everyday workflows
Extract data from the invoices and documents you receive
An invoice received as a PDF becomes a spreadsheet line in three steps: extract the text, have the AI fill in a strict JSON schema, then let code recalculate the totals, check the SIREN and look for duplicates. The accountant approves. E-invoices from approved platforms, on the other hand, arrive already structured.
29 min of reading
1 min 55 of video
7 diagrams
1 demande to copy
3 exemples pratiques
4 exercices answerss
5 questions
1 ressource
By the end of this lesson, you will know how to
Understand what the e-invoicing reform changes for the documents you receive
Write the JSON schema and instruction that extract an invoice without inventing any value
Set up automatic checks that stop a doubtful document before it is entered
What’s covered
What the reform changed on 1 September 2026
First look at what you already pay for
The supplier invoice workflow sheet
Extract the text, then the fields
Checks that code does better than AI
The same with Power Automate and AI Builder
3 worked examples, followed from start to finish
Exercise with answers · Parts invoices for a car garage
3 practice exercises, from guided to demanding cases
The quiz
Key points
Since 1 September 2026, every business receives e-invoices through an approved platform; SMEs start issuing them from 1 September 2027.
An e-invoice already arrives as structured data: AI extraction is for PDFs, expense claims and documents.
The AI copies into a strict JSON schema: amounts as numbers, dates as YYYY-MM-DD, null if missing, an “uncertain” boolean.
The code recalculates the totals, checks the SIREN and looks for duplicates; a single alert is enough to set “to check”.
Paying, changing an IBAN and deleting a document stay outside the workflow, in red.
Open the email, download the PDF, copy the supplier, number, date, amount excl. VAT, VAT and amount incl. VAT into a spreadsheet or the accounting software, rename the file, file it away: three minutes per document, not counting the typos that surface at bank reconciliation. For an SME receiving eighty invoices a month, that is half a day of re-keying. This lesson shows how to have a workflow read the documents, and above all how to stop it from making mistakes silently.
What the reform changed on 1 September 2026
Since 1 September 2026, every business must be able to receive e-invoices through an approved platform of its choice. Large and mid-sized companies already issue them in this form; SMEs and micro-businesses will do so from 1 September 2027. An e-invoice is not a PDF sent by e-mail: it is structured data, which the platform delivers to you already split into fields. For those, no AI is needed. Extraction is still needed for everything else: PDFs from your SME suppliers until they switch, foreign suppliers, expense claims, delivery notes, and the insurance or URSSAF (social contributions) certificates you request from subcontractors.
E-invoicing in France
1 Sept 2026Receiving for everyone
Every business must be able to receive e-invoices through an approved platform.
1 Sept 2026Issuing, large and mid-sized companies
Large companies and mid-sized companies issue their invoices electronically.
1 Sept 2027Issuing, SMEs and micro-businesses
SMEs and micro-businesses start issuing in turn, with certain data passed on to the tax authorities.
Timetable published by the French authorities. Between the two dates, your SME suppliers will keep sending PDFs.
First look at what you already pay for
Before you build anything, ask your accountant and open your tools' settings. Many accounting packages and online banks already read the receipts you forward to them by e-mail or upload to an app, and your approved platform delivers e-invoices to you as data. A home-made flow is justified when these tools don't cover your documents, or when the data needs to go elsewhere: a site tracking sheet, an ERP, a check against delivery notes.
Do you need an extraction flow
1Does the document arrive as a PDF or a photo, rather than as an e-invoice through your approved platform?
No The data is already structured: retrieve it from the platform, without AI.
2Doesn’t your accounting software or online bank already read these receipts?
No Switch on its document reading and forward invoice e-mails to it.
3Do you receive more than thirty documents of this kind a month?
No Entering it by hand is still quicker than building a workflow.
4Can you write down the list of fields to extract and what makes a document doubtful?
No First write the data entry instructions for a stand-in.
Yes to allExtraction flow: document text, fields as JSON, automatic checks, approval before entry.
Start with what you already pay for. The flow comes last.
The supplier invoice workflow sheet
Automation sheet · Extract supplier invoices received as PDFs
Box
What is decided
Trigger
An e-mail with a PDF attachment arrives at factures@, or a file is dropped into the shared folder Factures à traiter.
Data
The text of the PDF. Fields: supplier, supplier’s SIREN, customer’s SIREN, number, invoice date, due date (YYYY-MM-DD), amount excl. VAT, VAT by rate, amount incl. VAT (numbers), IBAN shown. Personal data: rarely (sole-trader tradespeople).
Decisions
The AI only extracts, with an “uncertain” field. The code decides: totals consistent to the cent, valid SIREN, no duplicate supplier + number, date in the past. A single alert means status “to check”.
Actions
1. Extract the text. 2. Extract the fields as JSON. 3. Check. 4. Rename the PDF “YYYY-MM-DD_supplier_number.pdf” and file it. 5. Add the row to the Purchases table, status “to approve” or “to check”. Account: factures@, dedicated login.
Inspection
Orange for pre-entry, red for payment and bank details. Error: email to Claire, accountant and owner of the workflow; the manager stands in for her. Log: Log tab of the Purchases table. Review of ten random lines every month.
From attachment to approved row
1Document received
E-mail to factures@ or file dropped into a shared folder.
2Document text
Text extracted from the PDF; a document with no text goes to manual entry.
Totals recalculated, SIREN checked, duplicates searched for, date plausible.
5Approval
Line set to “to approve” in the table; the accountant confirms or corrects it.
The AI reads, the code checks, a person approves. Payment stays outside the flow.
Extract the text, then the fields
In n8n, the Extract From File node, “Extract From PDF” operation, reads the file received in the binary field data (default name) and outputs its text. Check on your own documents: a PDF generated by software gives clean text, a scan or photo may give none. The text then goes to the Information Extractor, which fills in the JSON schema below. Amounts are numbers, not strings: “1 234,56 €” written as is won't add up in a spreadsheet.
You extract the data from a purchase document received by [company name], SIREN [our SIREN]. You receive the raw text of the PDF.
Rules:
1. Copy, do not calculate. If a total is not written on the document, set null: a program will recalculate it.
2. Amounts: numbers with a decimal point, no spaces or symbols (1 234,56 € becomes 1234.56). A credit note keeps positive amounts and type_piece is avoir.
3. Dates in YYYY-MM-DD format. A date written 03/11/2026 is 3 November 2026.
4. The supplier is the issuer of the document, never [company name].
5. One VAT line per rate present (20, 10, 5.5, 2.1).
6. incertain = true if parts of the text are illegible, if several invoices seem to be present, or if you hesitated over an amount.
Do not invent any value missing from the text.
Roughly what you should get
A JSON object that matches the schema, with null wherever the document says nothing. If the AI writes a SIREN or an IBAN you cannot find in the PDF, the prompt has not been followed: that is exactly what the checks in the next section must catch.
Replace the square brackets with your company name and SIREN: without them, the AI sometimes confuses the issuer and the recipient.
Checks that code does better than AI
The AI reads; it mustn't be the only judge of what it has read. A Code node placed after extraction recalculates and checks, and sets a “to check” status as soon as an alert appears. Paste this code into an n8n Code node in JavaScript, “Run Once for All Items” mode. It was run as is under Node on 15 November 2026 on two documents, one sound, the other wrong throughout.
The Code node for automatic checksJavaScript
// Un SIREN fait 9 chiffres et respecte la clé de Luhn
function sirenValide(s) {
if (typeof s === "string" && /^\d{9}$/.test(s)) {
let somme = 0;
for (let i = 0; i < 9; i++) {
let n = Number(s[i]);
if (i % 2 === 1) { n = n * 2; if (n > 9) n = n - 9; }
somme = somme + n;
}
return somme % 10 === 0;
}
return false;
}
const resultats = [];
for (const item of $input.all()) {
const f = item.json;
const alertes = [];
// 1. HT + TVA = TTC, à un centime près
if (Math.abs(f.montant_ht + f.total_tva - f.montant_ttc) > 0.01) alertes.push("total incohérent");
// 2. SIREN du fournisseur
if (sirenValide(f.siren_fournisseur) === false) alertes.push("SIREN invalide ou absent");
// 3. Date lisible et pas dans le futur
const d = new Date(f.date_facture);
if (isNaN(d.getTime()) || d > new Date()) alertes.push("date douteuse");
// 4. Numéro présent
if (f.numero === null) alertes.push("numéro absent");
resultats.push({ json: { ...f, alertes, a_verifier: alertes.length > 0 || f.incertain === true } });
}
return resultats;
Duplicates are searched for separately, before the line is added: a lookup in the Purchases table on the supplier + number pair. If a line already exists, the document gets the status “probable duplicate” instead of a new line.
What each check catches
Inspection
Typical error caught
Status set
Net + VAT = gross
An 8 read as a 3, a deposit amount taken for the total
to check
SIREN and Luhn check digit
The customer’s SIREN copied instead of the supplier’s, one digit missing
to check
Supplier + number already present
The same invoice resent with a reminder
doublon probable
Date in the past and legible
A reversed date (11/03 instead of 03/11) that falls in the future
to check
IBAN different from the supplier record
Attempted bank-details change fraud
alert to the manager, red
The same with Power Automate and AI Builder
Reading an invoice with AI Builder in a cloud flow
In Power Automate, create an automated cloud flow with the new e-mail trigger from the Office 365 Outlook connector, filtered on messages with attachments.
Add an action, search for AI Builder, then choose “Extract information from invoices”.
In the invoice file field, choose the attachment content; for a long document containing a single invoice, fill in the Pages parameter (for example 1-2).
Add a condition on the confidence scores: for example, “Confidence of invoice total” below 0.8 leads to the “to check” status.
Add the row to an Excel table stored on SharePoint or OneDrive, with “Invoice total (number)” and “Invoice date (date)”.
Labels may vary depending on the version and the interface language: search for “AI Builder” in the list of actions.
Every field AI Builder reads comes with a confidence score between 0 and 1, which replaces the “uncertain” field of the n8n flow. The pricing has changed: the AI Builder credits included in some licences, such as the 5,000 in Power Automate Premium, were withdrawn on 1 November 2026, and new customers buy Copilot Credits. With no credit available, the action fails with a capacity error. Work out the numbers with your Microsoft 365 administrator before you build, using the consumption rate card published by Microsoft.
What the flow is allowed to do
Alone
Filing the PDF in the month’s folder
Add a “to approve” row
Flagging a probable duplicate
Proposed, then approved
Pre-entry of the purchase entry
Assignment to an expense account
Matching against the purchase order
Never by the flow
Releasing an invoice for payment
Changing a supplier’s bank details
Deleting a document
Our rule: in the first month, every line is set to “to approve”. After three weeks without errors, lines with no alert go through on their own.
Mistakes to avoid
Asking the AI to calculate the gross total or VAT total when the document doesn't state it, then saving its result.
A language model predicts figures the way it predicts words. A total that is a few euros out goes unnoticed, and the wrong line goes to the accountant looking just like a correct one.
The instruction says “copy, don't calculate” and sets missing totals to null. Calculation and checking happen in a Code node or a flow condition.
Leaving amounts as text in the schema (“1 234,56 €”).
The spreadsheet does not add them up, sorting is wrong, and separators vary from one supplier to another: 1.234 can mean one thousand two hundred and thirty-four or one point two.
Number type in the schema, a conversion rule written into the prompt (1 234,56 € becomes 1234.56), and a totals check that fails if the conversion went wrong.
Sending the AI the text of a scan or photo without checking that it contains anything.
Given empty or fragmentary text, the model still fills in the schema with plausible values. The row looks complete, and it is made up.
Check the length of the extracted text before the AI step and send documents that are too short to manual entry; make the “uncertain” field mandatory.
Automatically updating a supplier’s bank details from the IBAN read on an invoice.
This is the way in for bank detail change fraud: one convincing fake invoice is enough to divert the payments that follow.
The IBAN is copied for comparison only. A mismatch triggers an alert to the manager and a call to the supplier's number already on file; the record only changes after that check.
3 SME situations followed from start to finish: the prompts exactly as they were written, the model answer to aim for, and what was checked before sending.
Example 1
Subcontractor invoices for an architecture firm
Inès is an administrative assistant at a 7-person architecture practice in Bordeaux's Saint-Michel district. The practice receives around forty invoices a month: engineering consultancies, surveyors, plan printing, software. Each invoice has to be assigned to a project to track profitability, and Inès spends a morning a month on it.
From invoice to project tracking
1Invoices label
Applied by a Gmail filter on known suppliers.
2PDF text
Extract From PDF.
3Fields and project
Project code copied, never guessed.
4Checks
Totals, SIREN, duplicates.
5Purchases line
Status and link to the renamed PDF.
Request 1
n8n Cloud workflow: Gmail trigger on the Factures label, Extract From File set to “Extract From PDF”, then Information Extractor with the lesson’s schema, plus one field: “code_projet: string or null. The firm’s projects have a code in the form P-YYYY-NNN (for example P-2026-014). Copy the code if it appears on the invoice; otherwise null. Never infer one from the site address.”
Inès checks the row against the PDF: everything matches. She adds a “project” column to the table, filled from code_projet, and a “project to assign” status when it is null.
Request 2
The Code node with the checks from the lesson, then a Google Sheets lookup on the supplier + number pair before adding, then adding the line with its status.
Model answer
Line added to the Purchases tab: 04/11/2026 · Bureau d'études structures · 2026-0412 · 3 200,00 · 640,00 · 3 840,00 · P-2026-014 · status “to approve” · link to the renamed PDF 2026-11-04_bureau-etudes-structures_2026-0412.pdf.
After three weeks without a discrepancy, Inès lets rows with no alert and a project code go through to “approved” on their own.
What was checked before sending
Test on fifteen invoices from the previous month: one in three had no project code, and it was correctly left as null instead of being guessed.
Deliberate error: the same invoice sent twice, flagged “probable duplicate”.
Calculations: totals recalculated by the code, no discrepancies over the month.
Order of magnitude: the monthly morning of data entry becomes half an hour of approval, and profitability per project can be read every week instead of once a quarter.
Example 2
A caterer's invoices and delivery notes
Franck runs an 18-employee restaurant and catering business in Arcachon. Around ten suppliers (seafood, meat, fresh produce, drinks) deliver every morning with a paper delivery note, then send a weekly invoice as a PDF. Discrepancies between what is delivered and what is invoiced, a few kilos of fish here and there, cost him several hundred euros a month by his estimate.
A week of deliveries
Every morningPhoto of the delivery note
Sent by the chef to bl@, extracted as item lines.
Friday 7amInvoices extracted
Suppliers’ weekly PDFs.
Friday 7.10amComparison
Delivered versus invoiced, item by item.
Friday 9amManager's phone call
With the delivery notes attached to the discrepancy e-mail.
Request 1
Make scenario: the head chef photographs each signed delivery note with their phone and sends it to bl@. Gmail “Watch Emails” module, then an AI module with structured output: “Extrais du bon de livraison : fournisseur, date (AAAA-MM-JJ), et pour chaque ligne la désignation, la quantité livrée et l'unité (kg, pièce, colis). Si une quantité est corrigée à la main, prends la quantité corrigée et mets corrige_a_la_main à true.” (Extract from the delivery note: supplier, date, and for each line the description, quantity delivered and unit; if a quantity is corrected by hand, take the corrected quantity and set corrige_a_la_main to true.) One line per item added to the Deliveries table.
Handwritten corrections are the weak point: Franck asks the chef to circle the corrected quantity, and every line corrected by hand stays “to check”.
Request 2
Second scenario, every Friday: extraction of the weekly invoices (the lesson’s schema, with item lines), then comparison by supplier and by item between the total quantities delivered that week and the quantities invoiced. Discrepancy above 2%: a line in the Discrepancies tab and an email to Franck.
Model answer
Discrepancy detected · Marée du Bassin · week of 10/11/2026 · Line-caught sea bass: delivered 18.9 kg, invoiced 21.5 kg, discrepancy 2.6 kg (13.8%) · notes of 10, 12 and 14/11 attached.
Franck calls the supplier with the three delivery notes in front of him and gets a credit note. The claim stays his: the flow prepares the file, it claims nothing.
What was checked before sending
Test on two weeks of delivery notes, compared line by line by Franck: three handwritten quantities misread, all marked corrige_a_la_main, so flagged for checking.
Calculations: the comparison and the percentage difference are done by Make’s functions, not by the AI.
Region: Make organisation created in the EU zone, no personal data.
Order of magnitude: matching deliveries against invoices, which nobody had time to do, takes ten minutes on a Friday; according to Franck, the discrepancies recovered pay for the subscription from the first month.
Example 3
AI Builder at an aluminium joinery manufacturer
Claire is accounting manager at a 55-employee aluminium joinery manufacturer in Saint-Jean-d'Illac. The department receives around 400 supplier invoices a month, many of them for profiles and glazing. The company runs entirely on Microsoft 365, and IT refuses to add yet another automation platform.
Before and after AI Builder
Before
400 entered by hand each month
Typos discovered at reconciliation
No tracking of pending documents
After
Reading by AI Builder, score per field
Totals rechecked by the workflow
Status visible for each document
Cost monitored monthly
Request 1
Power Automate flow: PDF dropped into the “Factures entrantes” SharePoint library, AI Builder action “Extract information from invoices” with Pages = 1-2, then a condition: if “Confidence of invoice total” or “Confidence of invoice ID” is below 0.85, status “to check”. Row added to the department's Excel table.
Model answer
Line added: Profilés du Sud-Ouest · FA-118204 · date 2026-11-06 · Subtotal (number) 18420 · Total tax (number) 3684 · Invoice total (number) 22104 · total confidence 0.97 · number confidence 0.93 · status “to approve”.
Claire adds the net + VAT = gross check as a condition in the flow: AI Builder gives a confidence score, not a guarantee.
Request 2
Calculation done beforehand with the Microsoft 365 administrator: 400 invoices a month, one to two calls per invoice depending on the attachments, consumption estimated from Microsoft's published rate card and compared with the Copilot Credits purchased, since included credits were withdrawn on 1 November 2026.
Model answer
Decision table: monthly volume, estimated usage, estimated monthly cost, alert threshold at 80% of the capacity allocated to the environment, person responsible for monitoring (the administrator).
The workflow was only put into service after this calculation. On the day the credits run out, the action fails: the error alert goes to Claire, who switches back to manual entry.
What was checked before sending
Test on fifty invoices: totals are read with high confidence, order numbers less well, hence the 0.85 threshold.
Calculations: excl. VAT + VAT = incl. VAT checked in a condition, on top of the scores.
Cost: usage tracked monthly by the administrator, with an alert threshold.
Order of magnitude: about fifteen hours of data entry a month replaced by four hours of approval, to be weighed against the credit cost calculated before going live.
Sandrine is an accounts secretary at a car repair garage in Lormont (8 employees). She receives about 120 invoices a month from four parts distributors, a tyre supplier, the company that rents out the tow truck and service providers (waste, IT). The distributors send one invoice per delivery, sometimes two deliveries a day, and a credit note for every part returned. Everything arrives as a PDF at factures@ (Gmail). The garage uses n8n Cloud and a Google Sheets table sent to the accountancy firm every month. Prepare the workflow.
Say what the e-invoicing reform changes for this garage, and from when.
Fill in the five boxes of the automation sheet.
Adapt the lesson's JSON schema to credit notes and to the repair order numbers that some distributors include.
List the automatic checks and the status each one sets.
Fix whatever is still red.
Describe five test documents, two of them with traps.
See the answers
Automation sheet · Extract the garage's parts invoices
Box
What is decided
Trigger
E-mail with PDF to factures@, Gmail filter on the seven known senders; the rest stay manual.
Data
PDF text. The fields from the lesson’s schema, plus numero_or (repair order) and parts lines (reference, quantity, unit price excl. VAT). Personal data: no.
Decisions
AI: extraction only. Code: totals, SIREN, date, duplicate supplier + number, credit note linked to an original invoice if its number is quoted.
Actions
Extract, check, rename and file in Drive by month, row in the Purchases tab with status, negative amount in the “signed amount” column for credit notes.
Inspection
Orange: Sandrine approves every line in the first month. Red: payment, IBAN. Error: email to Sandrine, the manager stands in for her. Review of ten lines a month with the accountancy firm.
The reform: since 1 September 2026, the garage must be able to receive e-invoices through an approved platform. Distributors that are large companies or mid-sized companies already issue them in this form: their data arrives structured, with no extraction needed. SME suppliers (waste, IT) will keep sending PDFs until their own deadline of 1 September 2027. The extraction workflow is therefore a transition tool, to be reviewed in autumn 2027.
To be merged into “properties” in the lesson's schema and added to the “required” list.
Checks: totals to the cent; sum of lines equals net; SIREN; date; duplicate supplier + number; credit note with no original invoice found, status “to check”.
Red: paying invoices, changing an IBAN, deleting a document.
Test 1: a sound invoice from a distributor. Test 2: a credit note. Test 3: the same invoice resent with a reminder (duplicate expected). Test 4: an invoice scanned at an angle (empty text, manual entry expected). Test 5: an invoice whose IBAN has been changed (alert to the manager expected).
Practise
Three more exercises, from the most guided to the most demanding. The material is provided in full: copy it into your tool, then check your work against the criteria before opening the answers.
Level 1 · guided10 min
Filling in an invoice’s JSON by hand
Without any tool, fill in the lesson’s JSON schema from the text of the invoice below, received by a communications agency in Bordeaux, SIREN 847654324. Then identify what the automatic check would flag.
The material to work on
IMPRIMERIE DES GRAVES · SARL · 12 avenue de la Libération, 33140 Villenave-d'Ornon
SIRET 812 345 676 00027 · VAT FR19812345676
INVOICE No. IG-26-0981 · Date: 05/11/2026 · Due: 05/12/2026
Customer: Agence Rive Droite, SIREN 847 654 324, 3 quai de Queyries, 33100 Bordeaux
Type: supply of goods
500 A5 16-page brochures ............ €640.00 excl. VAT
1,000 business cards ............... €85.00 excl. VAT
Delivery ............................ €25.00 excl. VAT
Total excl. VAT: €750.00
VAT 20%: €150.00
Total incl. VAT: €950.00
IBAN: FR76 0000 0000 0000 0000 0000 000
Check your work
Amounts are numbers with no spaces or symbols
The supplier’s SIREN is the first 9 digits of the SIRET, with no spaces
The AI copies the stated gross total (950): it doesn't correct it. It's the Code node that flags “inconsistent total” (750 + 150 = 900).
The document is set to “to check”. The right move is not to correct the total incl. VAT yourself but to call the printer: either the total incl. VAT is wrong or a line is missing. The dummy IBAN (filled with zeros) would also have triggered the alert comparing it with the supplier record.
Level 2 · independent20 min
An invoice with two VAT rates and a credit note
A caterer in Pessac receives the two documents below from a food wholesaler. Write the JSON for each, then the sentence to add to the system prompt so that credit notes and multiple rates are always handled this way. State which status each document gets after the checks.
The material to work on
PIÈCE 1
Grossiste Gironde Frais · SIREN 890 123 458
Facture GF-77120 du 10/11/2026
Produits alimentaires (TVA 5,5 %) : base 1 200,00 € · TVA 66,00 €
Boissons alcoolisées (TVA 20 %) : base 300,00 € · TVA 60,00 €
Total HT 1 500,00 € · Total TVA 126,00 € · Total TTC 1 626,00 €
PIÈCE 2
Grossiste Gironde Frais · SIREN 890 123 458
AVOIR AV-3315 du 12/11/2026 · sur facture GF-77120
Retour de 2 cartons de boissons (TVA 20 %) : base 60,00 € · TVA 12,00 €
Total avoir TTC : 72,00 €
Check your work
Document 1 has two lines in the tva table
Document 2 has type_piece “avoir” and positive amounts
The original invoice number is copied for the credit note
Both documents pass the total checks
The sentence added to the instruction is precise and testable
A credit note is identified by the words “avoir”, “note de crédit” or “credit note”: type_piece is avoir, the amounts stay positive as written, and facture_origine receives the number of the corrected invoice if it appears. An invoice with several VAT rates has one entry per rate in tva, with the net base and the amount for each rate as written.
Roughly what you should get
The instruction sets a single convention; the minus sign is applied afterwards by the flow, in the “signed amount” column, not by the AI.
Both documents pass the checks: 1,500 + 126 = 1,626 and 60 + 12 = 72, valid SIREN. They get the status “to approve”. The credit note is linked to GF-77120 by the lookup on the original number.
Level 3 · demanding case35 min
Three wrong lines in the Purchases spreadsheet
The extraction workflow of a plumbing and heating firm in Mérignac (22 employees) has been running for a month. The accountancy firm reports three incorrect lines. Compare each line with the original document, find the cause in the configuration, and propose the fix (instruction, schema or code), then the test that proves it works.
The material to work on
CONFIGURATION
Schema: amounts as string type · dates as string type with no format specified · no “uncertain” field
Instruction: “Extract the information from the invoice.”
Checks: no Code node; row added straight to the table
ROW A (table): Distrisanit · F-20931 · 2026-03-11 · Net "1.234" · VAT "246,80" · Gross "1 480,80 €"
DOCUMENT A: Invoice F-20931 dated 03/11/2026 · Total net €1,234.00 · VAT €246.80 · Gross €1,480.80
ROW B (table): Plomberie Mérignac Services · F-20931 · 2026-11-03 · Net "1234" · VAT "246,8" · Gross "1480,8"
DOCUMENT B: the same Distrisanit invoice F-20931, addressed to “Plomberie Mérignac Services”, resent on 10/11 with a reminder
ROW C (table): Chauffage Expert · 4471 · 2026-11-07 · Net "890" · VAT "178" · Gross "1068"
DOCUMENT C: crooked scan, illegible at the bottom of the page; only the line “Chauffe-eau 200 L” (200 L water heater) is legible
Check your work
The reversed date in row A is explained by an unspecified format
Line B is identified as both a duplicate and a supplier–customer mix-up
Line C is identified as probably invented amounts on an illegible document
The fixes involve the schema, the instruction and adding a check node
Every fix has its test
See the answers
Causes and fixes
Line
Cause
Correction
Test
A
Date read in US format; amounts as text, mixed separators
YYYY-MM-DD dates and the rule “03/11/2026 = 3 November” in the instruction; amounts as number type
An invoice dated 03/11: date_facture 2026-11-03
B
Supplier confused with customer; no duplicate check
Company name and SIREN in the instruction; supplier + number lookup before adding
Resend F-20931: status “probable duplicate”
C
Illegible document, no field marked uncertain: the AI filled in the gaps
Mandatory “uncertain” field; empty or too-short text goes to manual entry; totals check
A blurred scan: status “to check”, no amount invented
The rewritten instruction, at the top
You extract the data from a purchase document received by Plomberie Mérignac Services, SIREN [our SIREN]. The supplier is the issuer, never Plomberie Mérignac Services. Copy, do not calculate. Amounts as numbers with a decimal point. Dates in YYYY-MM-DD format; French dates are written DD/MM/YYYY. If part of the text is illegible, set the affected fields to null and incertain to true. Do not invent any value.
Roughly what you should get
A prompt that names the company, sets the formats and requires the AI to state uncertainty instead of filling the gap.
The safeguard before the AIJavaScript
// Nœud Code placé entre Extract From PDF et l'extraction par l'IA :
// un texte trop court signale un scan ou une photo, envoyés en saisie manuelle.
return $input.all().map(item => ({
json: { ...item.json, texte_suffisant: (item.json.text || "").trim().length >= 200 }
}));
// Puis un nœud If : texte_suffisant faux → ligne « saisie manuelle », sans IA.
All the course prompts to copy, both for the assistant that helps you build and for the AI step of a flow, including answers, practical examples and practice tasks, sorted by module and lesson, with filters to find the right one.
For each lesson, the main exercise and the three graded practice tasks with their materials, to do on paper or alongside your automation platform; all the answers are grouped at the end.
The course’s practical examples, job by job: the situation, the prompt as it was written, the model answer and what was checked before letting the flow run.
All the lessons in a single PDF: objectives, written course with its diagrams, tables and requests, common mistakes, exercise and key takeaways. The practice exercises and answers are in the workbook, the examples in the collection.
Your notes stay on this device; they are not sent anywhere.
A question for the tutor
A result that doesn’t match the model answer, a prompt that gets you nowhere, a case specific to your business: write to us with your prompt and the response you got. A Bonbay Académie trainer replies within 24 working hours, on your case.