Multi-level approval workflow with Google Forms and Apps Script
Three-level spending request, mandatory reason for rejection, automatic reminders after 48 hours and a PDF purchase order, with no third-party licence.
The need
Google Forms collects answers but cannot route a request from one approver to the next. This case builds a state machine around Google Sheets and an Apps Script web app, without sharing the spreadsheet with approvers.
The workflow at a glance
-
Requester
Enters the need, category and amount in the form.
-
L1 — Manager
Assesses whether the expense makes operational sense.
-
L2 — Financial control
Checks budget availability and cost allocation.
-
L3 — Management
Gives final financial approval.
-
Purchase order
PDF generated in Drive and sent to the requester.
Functional architecture
The workflow keeps three roles apart: input (Google Forms), state storage (Google Sheets) and orchestration (an Apps Script web app). Each request goes through the three approval levels in order; a rejection at any level closes the file.
| Step | Actor | Assigned by | Checks | Triggered action |
|---|---|---|---|---|
| Start | Requester | Email collected by Forms | Need, category, amount | Creates the UUID token, notifies L1 |
| Level 1 | Line manager | Entered in the form (col. F) | Does the expense make sense? | Approves (to L2) or rejects with a reason |
| Level 2 | Financial control | Fixed setting (CONFIG_NIVEAUX) | Budget and allocation | Approves (to L3) or rejects with a reason |
| Level 3 | Senior management | Fixed setting (CONFIG_NIVEAUX) | Final financial approval | Generates the PDF purchase order and closes |
Data model in Google Sheets
Once the form is linked to the spreadsheet, columns A to F receive the answers. Nine technical columns (G to O), added in row 1, let the script know the exact state of each file. Headers stay in French, as the script reads them as written.
| Col. | Exact header | Source | Role |
|---|---|---|---|
| A | Horodateur | Forms | Submission date and time |
| B | Adresse e-mail | Forms | Requester, recipient of notifications and of the PDF |
| C | Intitulé de la dépense | Forms | Subject of the purchase request |
| D | Catégorie | Forms | Hardware, Software, Travel, Service |
| E | Montant TTC (€) | Forms | Amount printed on the purchase order |
| F | E-mail Manager N1 | Forms | First approver, chosen by the requester |
| G | Token | Apps Script | Unique identifier (UUID v4) that authenticates action links |
| H | Étape Actuelle | Apps Script | State cursor: 1, 2, 3 in progress, 0 closed |
| I | Décision N1 | Apps Script | Pending, Approved or Rejected |
| J | Décision N2 | Apps Script | Pending, Approved, Rejected or Cancelled |
| K | Décision N3 | Apps Script | Pending, Approved, Rejected or Cancelled |
| L | Statut Global | Apps Script | Readable summary for administrative follow-up |
| M | Motif du refus | Apps Script | Mandatory justification when rejected |
| N | Dernière action | Apps Script | Reference timestamp for 48-hour reminders |
| O | Bon de commande PDF | Apps Script | Drive link to the document generated after L3 approval |
Engineering and security principles
- Idempotence and order control (
level !== etapeActuelle): each action link carries the UUID token and the expected level. A double click, or L3 acting before L2, is blocked by comparing it with the "Étape Actuelle" column. - Least privilege: deployed as "Execute as: Me", the app writes to the spreadsheet and to Drive while no approver has access to them.
- Concurrency (
LockService): a 10-second exclusive lock protects each read-write, so that two simultaneous clicks cannot corrupt a row. - Client-server exchange (
google.script.run): the "Reject" button opens an HTML form whose submission calls the server functionenregistrerRefus()to store the reason and close the workflow. - Response time (48 h): a time-driven trigger checks column N. After 48 hours without action, the approver gets a reminder and the timestamp is reset, spacing reminders 48 hours apart.
Step-by-step deployment
- Prepare Google Forms: turn on "Collect email addresses", then create the 4 questions in the order of columns C to F (Title, Category, Amount incl. VAT, L1 manager email).
- Set up Google Sheets: link the form to a spreadsheet and type the 9 technical headers in cells G1 to O1.
- Install the code: open Extensions > Apps Script, paste the script, fill in the L2 and L3 emails, then save.
- Publish the web app: Deploy > New deployment > Web app, "Execute as: Me", "Who has access: Anyone". Copy the
/execURL into theWEB_APP_URLconstant, then publish a new version (Manage deployments). - Turn on both triggers (alarm clock icon):
onFormSubmit, from spreadsheet, on form submit;relancerValidationsEnAttente, time-driven, every 6 hours.
Upgrade to Google Workspace Business with your custom domain and built-in Gemini AI
Get a 14-day free trial and a discount on your first year of Google Workspace Business (professional Gmail, secure Drive, Meet, Docs, Sheets, and built-in Gemini AI).
Developer and trainer specialized in Google Workspace automation, custom add-ons (Google Sheets, Docs, Gmail), and AI integration (Gemini, Claude).
Updated on