My Thoughts
Shopify Custom Contact Form Integration with Google Sheets and Drive
by Devang BhattPurpose: To collect customer bike sale inquiry data from a Shopify storefront and send it to a Google Sheet, with photos uploaded to Google Drive.
Form Fields:
-
Name
-
Email
-
Phone
-
Bike Brand
-
Bike Model
-
Insurance Active (Yes/No)
-
RTO Detail
-
Manufacturing Year
-
Photo Upload (up to 5 images)
Technology Stack:
-
HTML/CSS/JavaScript (Frontend)
-
Google Apps Script (Backend for Google Sheet and Drive)
-
Shopify (hosted as a custom page or embedded app)
Frontend Flow:
-
HTML form collects the user data.
-
JavaScript handles form validation, converts images to Base64, and submits data via
fetch()
to Google Apps Script Web App. -
Loading animation is shown while data is being submitted.
-
On successful submission:
-
Data is stored in a Google Sheet.
-
Images are uploaded to a folder in Google Drive.
-
A thank-you message is shown.
-
Backend (Google Apps Script) Responsibilities:
-
Parse incoming POST request.
-
Save text fields to Google Sheet.
-
Save each base64 image to Google Drive (convert and name properly).
-
Link image URLs in the corresponding row in the Google Sheet.
-
Return "Success" or error message.
How to Use in Shopify:
-
Add the HTML code to a custom page or a custom app block in your Shopify theme.
-
Host the form as a separate file or use Shopify's theme editor.
-
Deploy your Google Apps Script Web App (get the URL).
-
Replace the placeholder
YOUR_WEB_APP_URL
in the form JavaScript with the actual URL.
Brand Use Case: Perfect for bike dealers and resellers who want to collect high-quality leads with full bike details and photo uploads directly through their Shopify store.