Google Sheets Daily Backup to SharePoint
Each night the flow exports a Google Sheet to Excel/CSV, versions it into a dated SharePoint folder, prunes backups beyond a retention window, and posts a success/failure note to Teams. Gives Google Sheets data a governed, point-in-time backup in Microsoft 365.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow gives a Google Sheet a governed, point-in-time backup inside Microsoft 365. On a nightly schedule it reads the configured worksheet, converts the rows to CSV, versions the file into a dated SharePoint folder, prunes backups older than a retention window, and posts a success or failure note to Microsoft Teams. Why it matters: Google Sheets edits are easy to lose or overwrite, and Google's own version history is hard to govern centrally. Scheduled, retained CSV snapshots in SharePoint give the team an auditable, recoverable backup that lives alongside the rest of their Microsoft 365 content. Status: Ships Off — going live requires only connection authorization and setting the environment-variable values (no logic changes).
Use Case
A team relies on a critical Google Sheet (a tracker, register, or roster) and wants automatic dated backups in SharePoint without manual exports. IT Admins and Operations get a hands-off retention policy and a daily confirmation in Teams that last night's snapshot was captured.
Flow Architecture
Nightly Backup (Recurrence)
RecurrenceRuns once per day during the maintenance window (default 01:00 UTC).
Get Sheet Rows
Google Sheets — GetItemsReads every row from the configured worksheet (the full point-in-time snapshot).
Build CSV Table
Create CSV tableConverts the rows into CSV text.
Compose Dated Folder
ComposeBuilds the destination folder path (library path + yyyy-MM-dd).
Compose File Name
ComposeBuilds the timestamped file name (prefix_yyyyMMddHHmmss.csv).
Save Backup To SharePoint
SharePoint — CreateFileWrites the CSV into the dated folder (intermediate folders auto-create).
Get Existing Backups
SharePoint — GetFileItemsLists all backup files in the library for pruning.
Filter Old Backups
Filter arrayKeeps only files whose Modified date is older than the retention window.
Prune Old Backups
SharePoint — DeleteItemForeach over expired files deletes each by list item ID.
Notify Success
Microsoft Teams — PostMessageToConversationRuns after the backup scope succeeds; posts file name, folder, row count, and pruned count.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GSheetSpreadsheetId | String | <configure> | Google Sheets spreadsheet (file) ID to back up. |
| flowlibs_GSheetWorksheetName | String | Sheet1 | Worksheet/tab name to export. |
| flowlibs_BackupLibraryPath | String | /GSheet Backups | Server-relative SharePoint library/folder path (CreateFile folderPath). |
| flowlibs_BackupLibraryId | String | <configure> | Backup document-library list GUID (GetFileItems/DeleteItem table param). |
| flowlibs_RetentionDays | String | 30 | Days to retain backups before pruning. |
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | SharePoint site URL. |
| flowlibs_TeamsGroupId | String | <your-team-id> | Microsoft Teams group/team ID for the notification. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Microsoft Teams channel ID for the notification. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Google Sheets | shared_googlesheet | GetItems |
| SharePoint | shared_sharepointonline | CreateFile GetFileItems DeleteItem |
| Microsoft Teams | shared_teams | PostMessageToConversation |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Schedule
- Change the Nightly Backup recurrence (frequency/interval/start time) to back up more or less often.
- Retention
- Adjust flowlibs_RetentionDays; the prune step is fully driven by this value.
- Multi-tab backup
- Wrap the export steps in a Foreach over a list of worksheet names to back up every tab into the same dated folder.
- Raw .xlsx instead of CSV
- Replace GetItems + Create CSV table with the Google Sheets file-export op and write the binary with CreateFile.
- Hash skip
- Store a hash of the rows and skip the backup when the sheet is unchanged since the last run.
- Folder cleanup
- After pruning files, optionally delete now-empty dated folders.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Dated folder path
Each night versions into its own dated folder.
EXPR.02Backup file name
Timestamped CSV file name.
EXPR.03Retention cutoff (Filter array)
Keeps only files older than the retention window.
EXPR.04Row count (Teams summary)
Number of rows backed up.
EXPR.05Pruned count (Teams summary)
Number of old backups pruned.
EXPR.06Retention as integer
Converts the retention env var to an integer for date math.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.