Upstate AI

Google Apps Script Deployment Guide

Overview

The Google Apps Script project has been created and is ready to deploy. The script automatically receives form submissions from the AI Readiness Assessment, appends data to a Google Sheet, and sends email notifications.

Project Details

What the Script Does

  1. Receives POST requests with form submission data (JSON)
  2. Appends a row to the Google Sheet with:
    • Timestamp
    • Lead name, email, company, industry, company size
    • Assessment score (total and by dimension)
    • Tier assignment and recommended service
    • Raw answer data
  3. Sends an email notification to ben@up-state-ai.com with lead details and assessment results
  4. Returns JSON success/error response with CORS headers

Data Structure Received

{
  "name": "string",
  "email": "string",
  "company": "string",
  "industry": "string",
  "companySize": "string",
  "totalScore": "number (12-60)",
  "tier": "Explorer|Builder|Accelerator|Leader",
  "recommendedService": "string",
  "servicePrice": "string",
  "strongest": "string (dimension name)",
  "weakest": "string (dimension name)",
  "dimensionScores": { "dimension": score, ... },
  "answers": { "1": value, ... },
  "timestamp": "ISO 8601 timestamp"
}

Deployment Steps (Manual)

1. Open the Script Editor

Visit: https://script.google.com/d/1MHJba5dUWLQhboUI8NYkEELA4VPHK2otxjKD_pDNdIOAUgbKuZv4mjrI/edit

Sign in with: nichols.ai.assistant@gmail.com

2. Verify the Code

You should see two files in the editor:

If they’re not there, copy the code from docs/apps-script-setup.js into Code.js and update appsscript.json to:

{
  "timeZone": "America/New_York",
  "dependencies": {},
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "webapp": {
    "executeAs": "USER_DEPLOYING",
    "access": "ANYONE_ANONYMOUS"
  }
}

3. Deploy as a Web App

  1. Click Deploy > New deployment
  2. Select type: Web app
  3. Set “Execute as”: Me (nichols.ai.assistant@gmail.com)
  4. Set “Who has access”: Anyone
  5. Click Deploy
  6. Authorize the script when prompted (grant permissions for Sheets and Gmail)
  7. Copy the Web app URL from the deployment window

4. Update the Assessment Form

Replace YOUR_APPS_SCRIPT_WEB_APP_URL in js/assessment.js with the actual deployed URL.

Example:

var APPS_SCRIPT_URL = 'https://script.google.com/macros/d/1MHJba5dUWLQhboUI8NYkEELA4VPHK2otxjKD_pDNdIOAUgbKuZv4mjrI/userweb?v=VERSION';

5. Commit and Push

git add -A
git commit -m "Deploy Apps Script and update assessment form endpoint"
git push origin main

Testing

1. Test the Endpoint

Once deployed, test with curl:

curl -X POST "https://script.google.com/macros/d/.../userweb" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test User",
    "email": "test@example.com",
    "company": "Test Co",
    "industry": "Technology",
    "companySize": "50-100",
    "totalScore": 35,
    "tier": "Builder",
    "recommendedService": "AI Audit",
    "servicePrice": "$5,000",
    "strongest": "Data Maturity",
    "weakest": "Governance & Risk",
    "dimensionScores": { "data": 8, "process": 7 },
    "answers": { "1": 3, "2": 2 },
    "timestamp": "2026-03-20T10:25:00Z"
  }'

Expected response:

{"status": "success"}

2. Check Google Sheet

Go to the sheet at: https://docs.google.com/spreadsheets/d/1xgzHu4_fDIiPgNkbuucdNunC_CtiGIu-svHyurvHDpY

You should see a new row with the test data.

3. Check Email

ben@up-state-ai.com should receive an email notification with the lead details.

Troubleshooting

“Insufficient Permission” Error

The Apps Script needs authorization. When you first deploy, Google will prompt you to grant permissions for:

Click “Allow” to authorize.

Email Not Sending

Check the Script Execution Log:

  1. Open Script Editor
  2. Click Execution log (bottom of page)
  3. Look for errors from the sendNotification() function

Common issues:

No Data in Sheet

Check the Script Execution Log for errors appending rows. Verify:

GitHub Pages Staging URL

Once deployed and committed:

The form will submit to the deployed Apps Script endpoint.

Notes