A Google Apps Script that uploads images from Google Drive directly to AWS S3 with AWS Signature Version 4 authentication.
- 📤 Upload images from Google Drive to AWS S3
- 🔐 Secure AWS Signature V4 authentication
- 📊 Simple spreadsheet interface
- 🎨 Custom menu integration
- 🛡️ Error handling and validation
- 🔧 Configurable S3 paths
- A Google account
- An AWS account with S3 access
- AWS credentials (Access Key ID and Secret Access Key)
- An S3 bucket (with appropriate permissions)
- Go to Google Sheets
- Create a new spreadsheet
- Name it something like "S3 Image Uploader"
- In your spreadsheet, click Extensions → Apps Script
- Delete any existing code in the editor
- Copy and paste the entire
Code.gsfile from this repository
- In the Apps Script editor, click Project Settings (⚙️ icon on the left)
- Scroll down to Script Properties
- Click Add script property and add the following:
| Property | Value | Example |
|---|---|---|
ACCESS_KEY |
Your AWS Access Key ID | AKIAIOSFODNN7EXAMPLE |
SECRET_KEY |
Your AWS Secret Access Key | wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
BUCKET_NAME |
Your S3 bucket name | my-images-bucket |
REGION |
Your AWS region | us-east-1 |
Ensure your S3 bucket policy allows uploads. Here's a sample policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR_ACCOUNT_ID:user/YOUR_USER"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*"
}
]
}- Upload an image to Google Drive
- Right-click the image → Share → Change to Anyone with the link
- Copy the share link (format:
https://drive.google.com/file/d/FILE_ID/view)
- Go back to your spreadsheet
- In cell A2, paste the Google Drive share link
- (Optional) In cell B2, specify a custom S3 path like
images/myfile.jpeg - Refresh the page to see the custom menu
- Click 🚀 S3 Upload → Upload Image
- Wait for the success message with your S3 URL!
Cell A2: https://drive.google.com/file/d/1ABC...XYZ/view
Cell B2: (leave empty for default path)
The image will be uploaded to: s3://your-bucket/images/uploaded-image.jpeg
Cell A2: https://drive.google.com/file/d/1ABC...XYZ/view
Cell B2: photos/2024/vacation.jpeg
The image will be uploaded to: s3://your-bucket/photos/2024/vacation.jpeg
| Property | Required | Description | Default |
|---|---|---|---|
ACCESS_KEY |
✅ Yes | AWS Access Key ID | - |
SECRET_KEY |
✅ Yes | AWS Secret Access Key | - |
BUCKET_NAME |
✅ Yes | S3 bucket name | - |
REGION |
❌ No | AWS region | us-east-1 |
To change the default upload path, modify line 91 in Code.gs:
const keyName = sheet.getRange('B2').getValue() || 'your/custom/path.jpeg';"Invalid Google Drive URL"
- Ensure the link format is:
https://drive.google.com/file/d/FILE_ID/view - Make sure the file is shared with "Anyone with the link"
"Failed to upload file to S3"
- Verify your AWS credentials are correct
- Check that your IAM user has
s3:PutObjectpermission - Ensure the bucket name and region are correct
- Check S3 bucket CORS settings if accessing from web
"Failed to fetch image from Google Drive"
- Ensure the file is publicly accessible
- The file must be an image format
- Check that the share link is valid
To see detailed logs:
- In Apps Script editor, click Execution log at the bottom
- Run the script
- Check logs for detailed error messages
Contributions are welcome! Here are some ways you can help:
- 🐛 Report bugs
- 💡 Suggest new features
- 📝 Improve documentation
- 🔧 Submit pull requests
- Fork this repository
- Clone your fork
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- AWS Signature Version 4 signing process
- Google Apps Script community
- Contributors and users
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing GitHub Issues
- Create a new issue with detailed information
If you find this project helpful, please give it a ⭐️ on GitHub!
Made with ❤️ for the open-source community