n8n

How to Automate Google Sheets to Drive Image Optimization?

Speed up image prep for the web by turning JPG and PNG links in a Google Sheet into compact WEBP files stored in Google Drive. Great for marketing teams, content managers, and ecommerce catalogs that need lighter images for faster pages and better SEO. Work runs from a simple sheet queue so anyone on the team can add links and see results.

The build starts with a manual run. It grabs the next image URL from the sheet, reads the file name and extension, and chooses the right path for JPG or PNG. The system calls an image service to create a WEBP version, writes the output link back to the sheet, then downloads the new file and uploads it to Google Drive with a clean name. The sheet marks the row as done so you do not repeat work.

The queue in Sheets keeps the process simple and visible. Both JPG and PNG are supported, and files end up in one Drive folder with consistent naming. You need accounts for Google Sheets, Google Drive, and an API key for the image service. Expect less manual clicking, smaller image sizes, and faster site speed. Useful for blog posts, product pages, and agency asset handoffs.

What are the key features?

  • Manual start to process the next image link from Google Sheets
  • Code step extracts file name and extension for clean WEBP naming
  • Switch logic routes JPG and PNG to the correct conversion path
  • HTTP requests convert images to WEBP using an external image service
  • Sheet update writes the output URL and marks the row as done
  • File download pulls the converted WEBP from the returned link
  • Google Drive upload stores the final file in a set folder with a .webp name

What are the benefits?

  • Reduce manual work from hours of bulk converting to a few minutes per batch
  • Streamline asset preparation by about 70 percent with a simple sheet queue
  • Improve web performance by cutting file sizes with WEBP output
  • Eliminate most format errors by routing JPG and PNG through the right path
  • Centralize tracking with a DONE flag and output link in Google Sheets

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Google Sheets, Google Drive and APYHub. See the Tools Required section above for links to create accounts with these services.
  3. Prepare your Google Sheet with columns named FROM, TO, and DONE. Add image URLs in the FROM column for JPG, JPEG, or PNG files.
  4. In the n8n credentials manager, connect your Google Sheets account: open the Google Sheets node, choose Credential to connect with, click Create new credential, then follow the on screen steps to finish OAuth in n8n Cloud.
  5. In the n8n credentials manager, connect your Google Drive account the same way from the Google Drive node and complete OAuth.
  6. Get your API key from the image service account page in APYHub. Open the Set API KEY node and paste the key into the apikey field.
  7. Open the Get images node and select your Sheet and worksheet. Use the filter so it pulls rows where DONE is empty to process only new items.
  8. Check the Get extension code node to confirm it extracts FILENAME and EXTENSION from the FROM URL. Keep jpg, jpeg, and png covered.
  9. Open both conversion HTTP Request nodes and make sure the header key for the token matches the API requirement. Use the same token header name in both nodes.
  10. In the Update Sheet node, map TO to the API response field that includes the output link and set DONE to x. Keep row_number mapped from the Get images item.
  11. In the Upload image node, select your Google Drive folder. Keep the file name expression so it saves as the original base name with a .webp extension.
  12. Click Test workflow in n8n. Confirm the sheet row is updated, the DONE flag is set, the TO link works, and the WEBP file appears in your Drive folder.
  13. If a path fails, check the switch conditions for the file extension and verify the API token header name and value. Fix any sheet column name typos.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

APYHub

Sign up

Free tier: $0 / mo, 5 API calls/day

Google Drive

Sign up

Drive API: $0 (no additional cost; quota-limited)

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.