Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Files & Cloud Storage

Files & Cloud Storage

Archive last month's invoice tab to dated Drive folders with Google Sheets

Runs on the first of each month to copy last month's invoice tab into that month's Drive folder, creating the folder if needed, then emails a link.

What it does

# Archive last month's invoice tab into a dated Drive folder On the first of every month this lifts last month's tab out of your working invoice spreadsheet, files a formatted copy inside that month's Drive folder, and emails you a link. The working sheet stops growing forever and your accountant gets one clean file per month, next to the invoices themselves. ### How it works 1. A Code node works out last month once and hands the tab, folder and archive names to every node after it. 2. Drive is searched for the month folder, for example 2026-03, and it is created if missing. 3. The folder is checked for an archive of that month. If one exists the run stops, so re-running never duplicates. 4. The tab list is searched for last month. If it is missing you get an email listing the tabs that do exist. 5. A new spreadsheet is created through the Sheets API and moved into the folder, so no Apps Script is needed. 6. The tab is copied in, then one batch call renames it, freezes and bolds the header, sizes columns and deletes the empty default sheet. 7. With the config flag on, last month's tab is deleted from the working sheet, but only after the archive exists. You then get a summary email with a link. ### Setup 1. Connect your Google account on the Sheets API nodes, Drive on the folder nodes, and Gmail. 2. Open Set config and add your spreadsheet ID, the parent folder holding your month folders, email and timezone. 3. Tabs must be named like March 2026 and month folders like 2026-03. 4. Leave removeTabAfterArchiving off until you trust the archive. ### Customization Change archiveSuffix for something other than Invoices in the file name.

The steps

  1. Run on the 1st
  2. Set config
  3. Work out last month
  4. Look for the month folder
  5. Folder exists?
  6. Create the month folder
  7. Use that folder
  8. Look for an existing archive
  9. Already archived?
  10. Stop, already done
  11. Get every tab in the sheet
  12. Find last month's tab
  13. Tab found?
  14. Email that there was nothing to archive

22 steps in total.

Similar automations