Forum Discussion
Ryan_Marquis1910
Feb 20, 2024Copper Contributor
Saving work into google drive and updating when saved from a different PC
We have a stand alone desktop that is used for project planning. It has an excel workbook containing sheets that automatically cycle through the sheets every minutes via a macro. There are 5 people who access this file and make changes to it. Once they save it I am wondering if there is a way to have the pc with it always up can auto update with the new changes.
The file is stored on google drive, some of the people don't use OneDrive. So co-authoring isn't an option, also because of the macro we cannot use shared workbook.
Any ideas would be greatly appreciated.
- AshaKantaSharmaIron ContributorYes, you can set up a system to ensure that your standalone desktop PC always has the most up-to-date version of your Excel workbook from Google Drive. Here are a few strategies to accomplish this:
### 1. **Google Drive Backup and Sync / Google Drive for Desktop**
1. **Install Google Drive for Desktop**: If you haven't already, install Google Drive for Desktop on the standalone PC. This tool will sync files between Google Drive and your local drive.
2. **Sync the File**: Make sure the specific folder containing your Excel workbook is selected for syncing. This will ensure that any changes made by others are automatically reflected in the local copy of the file.
3. **Auto-Update**: Google Drive for Desktop should automatically handle updates. When other users save changes, those changes will be synced to the standalone PC.
4. **Check Sync Status**: Ensure the sync status is up-to-date. You can do this by checking the Google Drive icon on the taskbar/system tray for sync activity.
### 2. **Create a Sync Script**
If you need more control, you can use a script to periodically check for updates and sync the file. Here’s a basic outline of how you might set this up:
1. **Install a Script Runner**: Install a task scheduler or script runner on your standalone PC. On Windows, you can use Task Scheduler.
2. **Write a Sync Script**:
- **Batch Script**: You could create a batch script to copy the latest version of the file from the Google Drive folder to the desired location.
- **PowerShell Script**: A PowerShell script could also handle more complex scenarios, like handling conflicts or checking file timestamps.
Here’s a basic example of a batch script to copy the file:
```batch
@echo off
setlocal
set "source=C:\path\to\GoogleDrive\Folder\file.xlsx"
set "destination=C:\path\to\Local\Folder\file.xlsx"
copy /y "%source%" "%destination%"
endlocal
```
3. **Schedule the Script**:
- Use Task Scheduler to run your script at regular intervals (e.g., every minute).
### 3. **Use Google Drive API**
If you're comfortable with coding, you can use the Google Drive API to programmatically check for updates and download the latest version of the file.
1. **Set Up API Access**: Obtain API credentials from the Google Cloud Console.
2. **Write a Script**: Use a programming language like Python to interact with the Google Drive API. Your script would check for the latest version of the file and download it if necessary.
Here’s a very high-level overview of what such a script might involve:
- Authenticate with the Google Drive API.
- Check the file’s modification timestamp.
- Download the file if a newer version is available.
3. **Automate the Script**: Schedule this script to run at regular intervals.
### 4. **Ensure Macros Compatibility**
Since macros can complicate things:
- **Macro Management**: Ensure that macros are not disrupted by sync processes. Sometimes, Excel macros may not function properly if the file is being synced or accessed from multiple locations.
- **Test Thoroughly**: Make sure to test your setup thoroughly to ensure that the macro’s functionality is not affected by the syncing process.