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
- Run on the 1st
- Set config
- Work out last month
- Look for the month folder
- Folder exists?
- Create the month folder
- Use that folder
- Look for an existing archive
- Already archived?
- Stop, already done
- Get every tab in the sheet
- Find last month's tab
- Tab found?
- Email that there was nothing to archive
22 steps in total.
Similar automations
Documents, PDF & OCRArchive changed web pages as dated PDFs in Google Drive using Gaffa and Sheets14 stepsDocuments, PDF & OCRArchive weekly web page snapshots into one PDF with PDFMint13 stepsWeb Scraping & ResearchScrape Booking.com hotel shortlists with Apify into dated Google Sheets18 stepsFiles & Cloud StorageFile Email Attachments into Drive Folders by Company13 steps