Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Two Invoices, One Number: Allocate Invoice Numbers From the Log, Not a Cell

Description and use

Using a cell as a counter for invoice numbers causes duplicates and missing log entries. By generating the number from the Log tab, uniqueness, sequence, and auditability are ensured.

Problem

Relying on a spreadsheet cell to hold the next invoice number causes duplicate numbers, missing log entries, and audit failures when the script runs concurrently or fails mid‑process.

Outcome

Duplicate invoice numbers are eliminated, log entries are always created, and the system meets audit requirements for sequential numbering.

Workflow

  • 1. Script reads the Log tab to find all issued numbers for the current prefix and year.
  • 2. It determines the highest sequence number and increments it.
  • 3. It formats the new number with leading zeros.
  • 4. The script writes the new number to the sheet for display.
  • 5. It proceeds to export the PDF, email, and append the new row to the Log with the generated number.

Evidence

The cell is the problem. B4 is a display: it shows the number the last person typed.

Source

Flip the direction. The Log tab already holds every number you have issued, so let it hand out the next one.

Source

  • Record date: 2026-09-22T20:45:49.146Z