Quick overview
This workflow runs monthly to archive last month’s invoice tab from a Google Sheets workbook into a new spreadsheet created in the matching Google Drive month folder, then renames the copied tab for accounting.
How it works
- Runs on a monthly schedule.
- Searches Google Drive for the folder named for last month in YYYY-MM format and calls a Google Apps Script web app to create a new spreadsheet in that folder.
- Calls the Google Sheets API to list all tabs in your main invoice spreadsheet and keeps only the tab whose title matches last month in “Month YYYY” format.
- Combines the destination spreadsheet details with the selected source tab information.
- Uses the Google Sheets API to copy the tab into the new spreadsheet and then renames the copied tab to “Month YYYY - Invoices”.
Setup
- Add Google OAuth2 credentials with access to Google Drive and Google Sheets.
- Replace YOUR_GOOGLE_SHEET_ID in the Google Sheets API request URLs with your main invoice spreadsheet ID.
- Deploy a Google Apps Script web app that accepts folderUrl and sheetName and returns the created spreadsheetId, then paste its URL into the workflow’s web request.
- Ensure a Google Drive folder exists for each month you want to archive, named in YYYY-MM format (for example, 2026-03).
- Make sure your invoice tab names follow the “Month YYYY” format so the workflow can match last month correctly.