How to auto-increment an invoice number in Google Sheets inside my Make scenario?

Hello everyone,

I’m building a Make scenario that pulls attendees from Billetweb and generates invoices. Everything works except one thing: I can’t auto-increment an invoice number in the Google Sheet where I append the API data.

Goal

  • Assign a unique, sequential invoice number to each new row (e.g., 2025-0001, 2025-0002…), even when multiple attendees are processed in the same run.

I’ve tried diferent things but not easy to explain in english :sweat_smile: (MAX, data store, formula in the sheet, …). Nothing worked.

My scenario :

  1. HTTP – Get attendees from Billetweb

  2. Tools – Iterator (one item per attendee)

  3. Google Sheets – Search Rows (check if Order ID already exists)

  4. Google Sheets – Add a Row (if new)

  5. Google Docs – Create invoice from a template (fill placeholders)

  6. Google Drive – Export to PDF and save to /INVOICES

  7. Google Sheets – Update Row (status, PDF link, dates)

  8. Email – Send the PDF, then mark as sent

Happy to provide the blueprint and screenshots if helpful. Thanks a lot for any guidance or examples! I’m a bit desperate :upside_down_face:

Bonjour @Margaux_Cps and bienvenue to the Make Community!

Which part of this is the problem? When you say data store, do you mean you try to store the invoice number in the data store and it doesn’t update correctly? Or do you man something else?

I suspect though that you may be running into the problem of things running in parallel.My suggestion would have been to use a data store or potentially a global variable to store the invoice number, but I think the data store is your best bet.

However, to make sure everything works correctly, you need at a minimum to tell your scenario to run sequentially.

You can access this from the ‘gearbox’ at the bottom of every scenario.

If that’s not helpful enough, please share a screenshot of the scenario and explain where the problems are.

L

Hi @L_Duperval — thank you very much for the guidance and sorry for the deleted posts!

So, I’d like to generate invoice numbers like 2025-0001, 2025-0002, … (year + zero-padded counter), with multiple attendees possibly processed in the same run.

What I changed based on your advice

  • Turned Sequential processing = ON. That already helped: I now consistently get the year prefix (2025-).

Current scenario :

  • HTTP (Billetweb) → fetch attendees.

  • Data Store — Check the existence of a record with key invoice_seq_{{formatDate(now;“YYYY”)}} → this tells me whether the yearly counter already exists.

  • Router → splits the flow only for the key-creation step:

    • If NOT existsData Store — Add/replace the yearly key with value = 0 (initialize the counter), then continue.

    • If exists → skip creation and continue.

  • (Then I iterate attendees.)

  • Google Sheets — Search Rows (50) → check if the Order ID is already in the sheet.

    • Filter: {{50._IMTLENGTH_}} = 0 → only proceed for new orders.
  • Data Store — Get a record (51) for invoice_seq_{{YYYY}} → read current counter.

  • Tools — Set variable (module 52) → seq_counter = add(51.value; 1) → this thould be the unique, sequential number (1, 2, 3…).

  • Data Store — Update a record → write back value = seq_counter so the next invoice will pick up the next number.

  • Tools — Set variable → invoice_no = {{formatDate(now;“YYYY”)}}-{{formatNumber(seq_counter;“0000”)}} → this should format the number as 4 digits and builds the final invoice number.

  • (Then I add the row, create the Doc from template, export PDF, email, etc.)

What’s still blocking

  • I get the 2025- prefix, but the zero-padded suffix doesn’t appear !

This is my scenario :


and my google sheet :

Hi Margaux,

You’re not using the correct formula. Make does not have a feature that allow you to format “8” as “0008”. Instead, you turn it into a string and get the part you want. So…

  1. Add a 10X value to your number to make sure the resulting string has enoug zeros. If you want 3 zeros, add 1000, if you want 4 0s add 10000, etc.
  2. Convert the result to a string
  3. Extract all the characters in the string except the first one

This is what this formula does:

{{formatDate(now; “YYYY”)}}-{{substring(toString(parseNumber(3 + 10000; )); 1; 5)}}

And… it’s weird, I was sure I sent it earlier. Don’t know what happened…

Replace the ‘3’ in parseNumber with your mapping and it should work.

L

1 Like

Thank you so much !!! It works !!! I had another problem, it was my first “tools -set variable” : i’ve put add(51.value; 1) and it doesn’t work, but this works : {{parseNumber(ifempty(51.value; 0)) + 1}}
Thank you again, I thought I would never do it !

Je suis bien content que ça vous ait été utile!

If you find that my response was the solution, remember to click that button that says so! It feeds the algo gods.… and my ego. :grinning_face_with_smiling_eyes::grinning_face_with_smiling_eyes::grinning_face_with_smiling_eyes:

If you have more questions on this, create a new topic so it’s easier for others to find and answer.

Have fun!

L

1 Like