Art Fundraiser Submission
Please submit one artwork per form. Fields marked with * are required.
How this form saves data
- By default, it will send JSON to a Google Apps Script Web App (you add the URL below).
- If a file is attached, it will use
multipart/form-datato upload the image to Google Drive (handled by Apps Script). - You can embed this page in Wix using the HTML/iframe embed.
Set your endpoint here (replace with your deployed Web App URL):
const ENDPOINT = "https://script.google.com/macros/s/YOUR_DEPLOYMENT_ID/exec"; // TODO: replace
Google Apps Script (Server) — paste into script.google.com
/**
* Web App endpoint to receive submissions from the HTML form.
* 1) New Apps Script project > Services: enable Drive and Spreadsheet Advanced Services if using those.
* 2) Replace SHEET_ID and (optional) DRIVE_FOLDER_ID.
* 3) Deploy > New deployment > Type: Web app; Execute as: Me; Who has access: Anyone with the link.
*/
const SHEET_ID = "YOUR_SHEET_ID"; // e.g., 1AbC... from the Sheet URL
const SHEET_NAME = "Form Responses"; // or create one; header row will be auto-appended
const DRIVE_FOLDER_ID = "YOUR_DRIVE_FOLDER_ID"; // optional: where to save uploaded images
function doPost(e) {
try {
const ct = (e.postData && e.postData.type) || "";
if (ct.indexOf("multipart/form-data") !== -1) {
return handleMultipart_(e);
} else {
return handleJson_(e);
}
} catch (err) {
return ContentService.createTextOutput(JSON.stringify({ ok:false, error: String(err) }))
.setMimeType(ContentService.MimeType.JSON);
}
}
function handleJson_(e) {
const data = JSON.parse(e.postData.contents || '{}');
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(SHEET_NAME) || SpreadsheetApp.openById(SHEET_ID).insertSheet(SHEET_NAME);
if (sheet.getLastRow() === 0) sheet.appendRow(Object.keys(data));
const row = Object.keys(data).map(k => data[k]);
sheet.appendRow(row);
return json_({ ok:true, mode:"json" });
}
function handleMultipart_(e) {
// Requires new Apps Script runtime (V8). The file comes in as a blob.
const params = e.parameter; // text fields
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(SHEET_NAME) || SpreadsheetApp.openById(SHEET_ID).insertSheet(SHEET_NAME);
// Ensure header
const headers = [
"timestamp","artist_full_name","age_group","email","phone","city_state","artwork_title","medium","dimensions","framed","year_created","short_description","asking_price","minimum_accepted","donation_choice","sales_handling","primary_image_url","additional_image_urls","public_display_consent","sales_terms_consent","shipping_pickup","notes","uploaded_file_url"
];
if (sheet.getLastRow() === 0) sheet.appendRow(headers);
let fileUrl = "";
try {
if (e.files && e.files.primary_image_file) {
const blob = e.files.primary_image_file;
const folder = DRIVE_FOLDER_ID ? DriveApp.getFolderById(DRIVE_FOLDER_ID) : DriveApp.getRootFolder();
const f = folder.createFile(blob);
f.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
fileUrl = f.getUrl();
}
} catch (fe) {}
const row = [
new Date(), params.artist_full_name, params.age_group, params.email, params.phone, params.city_state,
params.artwork_title, params.medium, params.dimensions, params.framed, params.year_created, params.short_description,
params.asking_price, params.minimum_accepted, params.donation_choice, params.sales_handling,
params.primary_image_url, params.additional_image_urls, params.public_display_consent, params.sales_terms_consent,
params.shipping_pickup, params.notes, fileUrl
];
sheet.appendRow(row);
return json_({ ok:true, mode:"multipart", uploaded_file_url:fileUrl });
}
function json_(obj){
return ContentService.createTextOutput(JSON.stringify(obj)).setMimeType(ContentService.MimeType.JSON);
}