In this article, we'll demonstrate how you can quickly turn your Excel files with complex formulas into dynamic, custom HTML/CSS/JavaScript applications using the SpreadsheetWeb API and ChatGPT. SpreadsheetWeb provides robust backend calculation capabilities that seamlessly integrate with frontend code, allowing you to convert your Excel models into interactive web applications. ChatGPT further simplifies this process by generating frontend HTML, CSS, and JavaScript code based on clear, structured prompts. This powerful synergy between AI-generated frontend code and SpreadsheetWeb's backend calculation capabilities enables anyone, including non-developers, to create web-based applications quickly and efficiently.

 

1. Publishing the Excel File as an API on SpreadsheetWeb

a. Uploading and Publishing Your Excel File

First, log in to your SpreadsheetWeb account:

  • Click "Create Application".
  • Upload your Excel file containing your formulas.
  • Name your application and configure the calculation settings.
  • Save and publish your application to generate your API endpoint.

b. Using SpreadsheetWeb API Toolkit

SpreadsheetWeb's API Toolkit helps you map input fields and output results directly from your Excel file:

  • Select input and output cells from your spreadsheet.
  • Configure data types and validation rules.
  • Generate and copy request/response JSON samples, crucial for crafting your ChatGPT prompt.

2. Building the Prompt for ChatGPT

Creating a clear, structured prompt is essential. Include the following sections:

a. Brief Description of the Application

Clearly explain your app’s purpose (e.g., "a simple engineering calculator" or "a two-page sales quoting tool").

b. Samples of JSON Messages

Provide specific examples of request and response JSON messages copied directly from the SpreadsheetWeb API Toolkit. Ensure these samples accurately reflect the input parameters and expected results from your Excel file. Clear JSON examples help ChatGPT generate precise, functional frontend code.

c. Type of Controls

Clearly specify the types of HTML form controls you want ChatGPT to bind to each input/output field from your API. This includes dropdown menus, textboxes, checkboxes, radio buttons, sliders, and date pickers. Clearly define these controls, including labels, default values, and specific UI behaviors or validations to enhance user experience. For example:

  • Dropdown for product selection
  • Numeric textbox for quantities
  • Date picker for dates
  • Checkbox or toggle switch for boolean values

d. CMS Compatibility

Clearly indicate if your generated frontend code needs to integrate with a specific Content Management System (CMS) such as WordPress, Wix, Drupal, Joomla, or Shopify. Mention specific CMS considerations like embedding methods (shortcodes, iframe, direct HTML embedding), style or script conflicts, and responsive design requirements to ensure seamless integration. For example:

  • "Ensure compatibility with WordPress shortcode or Gutenberg blocks."
  • "Generate code compatible with Wix HTML embed tool."
  • "Code should use Drupal-friendly markup for easy integration."

3. Embedding the Code into Your Website and Testing

After receiving your code from ChatGPT:

  • Paste the generated HTML/CSS/JS code directly into your website or CMS page editor.
  • Run thorough tests, inputting sample data to verify calculations and frontend interactions.
  • If issues occur, refine your ChatGPT prompt to address specific challenges and regenerate improved code.

Examples

Example 1: Simple One-Page Engineering Calculator

This engineering calculator uses calculations built into the Excel file to determine the required pipe diameter based on factors such as allowable head loss, pipe length, and fluid density.

ChatGPT Prompt:

I would like to build a single-page application using only HTML, CSS, and JavaScript. The application should allow users to enter a series of inputs, trigger a calculation by calling a SpreadsheetWeb Hub endpoint, and 
display a series of outputs.
Target API Endpoint:
https://private.spreadsheetweb.com/api/calculations/calculatesinglesimple

Styling:
Use Bootstrap for styling the page.

API Structure
Sample API Request:
{
  "request": {
    "workspaceId": "YOUR-WORKSPACEID",
    "applicationId": "YOUR-APPLICATIONID",
    "inputs": {
      "Allowable_Head_Loss": "5",
      "Assumed_Pipe_Diameter": "4",
      "Fluid_Density": "2",
      "Fluid_Viscosity": "0.000025",
      "Pipe_Flow_Rate": "0.75",
      "Pipe_Lenght": "50",
      "Pipe_Roughness": "0.0004"
    },
    "outputs": [
      "Pipe_Diameter"
    ]
  }
}
Sample API Response:
{
  "response": {
    "outputs": {
      "Pipe_Diameter": "2.98056249684458"
    }
  },
  "timingsSeconds": {
    "hubApiApplication": 0.1265283,
    "designerApplication": 0.1809439
  },
  "performanceInformation": null,
  "isError": false,
  "messages": null
}
User Interface Specifications:
- Inputs should appear on the page as textboxes.
- Output must be displayed in the following format:
 - Pipe Diameter = D = "outputValue" in.
- Output field names should be read without case sensitivity.

Inputs should be pre-populated with the default values provided in the sample JSON request.

Buttons and Navigation:
- Include a CALCULATE button. When clicked:
 - Collect input values.
 - Send a request to the API endpoint.
 - Display the returned outputs.

WordPress Theme Compatibility Requirements
- Write the final HTML/JS code as a single line.
- Make case-insensitive handling of the outputs section using the 
logic: outs = json.outputs || (json.response && json.response.outputs)

 

Final ChatGPT-Generated Code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Pipe Diameter Calculator</title>
  <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
    rel="stylesheet"
  />
</head>
<body>
  <div class="container py-5">
    <h1 class="mb-4">Pipe Diameter Calculator</h1>
    <div class="row g-3">
      <div class="col-md-6">
        <label for="Allowable_Head_Loss" class="form-label">
          Allowable Head Loss, hL (ft)
        </label>
        <input
          type="text"
          class="form-control"
          id="Allowable_Head_Loss"
          value="5"
        />
      </div>
      <div class="col-md-6">
        <label for="Assumed_Pipe_Diameter" class="form-label">
          Assumed Pipe Diameter, D* (in)
        </label>
        <input
          type="text"
          class="form-control"
          id="Assumed_Pipe_Diameter"
          value="4"
        />
      </div>
      <div class="col-md-6">
        <label for="Fluid_Density" class="form-label">
          Fluid Density, ρ (slugs/ft³)
        </label>
        <input
          type="text"
          class="form-control"
          id="Fluid_Density"
          value="2"
        />
      </div>
      <div class="col-md-6">
        <label for="Fluid_Viscosity" class="form-label">
          Fluid Viscosity, μ (lb·s/ft²)
        </label>
        <input
          type="text"
          class="form-control"
          id="Fluid_Viscosity"
          value="0.000025"
        />
      </div>
      <div class="col-md-6">
        <label for="Pipe_Flow_Rate" class="form-label">
          Pipe Flow Rate, Q (cfs)
        </label>
        <input
          type="text"
          class="form-control"
          id="Pipe_Flow_Rate"
          value="0.75"
        />
      </div>
      <div class="col-md-6">
        <label for="Pipe_Lenght" class="form-label">
          Pipe Length, L (ft)
        </label>
        <input
          type="text"
          class="form-control"
          id="Pipe_Lenght"
          value="50"
        />
      </div>
      <div class="col-md-6">
        <label for="Pipe_Roughness" class="form-label">
          Pipe Roughness, e (ft)
        </label>
        <input
          type="text"
          class="form-control"
          id="Pipe_Roughness"
          value="0.0004"
        />
      </div>
    </div>

    <button id="calculate-btn" class="btn btn-primary mt-4">CALCULATE</button>
    <p id="output-text" class="fs-4 mt-4"></p>
  </div>

  <script>
    const wsUrl =
      "https://private.spreadsheetweb.com/api/calculations/calculatesinglesimple";
    const wsIds = {
      workspaceId: "12d7c758-b138-426d-83a2-2e9cc73a5a4e",
      applicationId: "8138f403-9692-4176-8f3f-5e22df062b46",
    };

    document
      .getElementById("calculate-btn")
      .addEventListener("click", async () => {
        // 1) collect inputs
        const inputs = {
          Allowable_Head_Loss: document.getElementById(
            "Allowable_Head_Loss"
          ).value,
          Assumed_Pipe_Diameter: document.getElementById(
            "Assumed_Pipe_Diameter"
          ).value,
          Fluid_Density: document.getElementById("Fluid_Density").value,
          Fluid_Viscosity: document.getElementById("Fluid_Viscosity").value,
          Pipe_Flow_Rate: document.getElementById("Pipe_Flow_Rate").value,
          Pipe_Lenght: document.getElementById("Pipe_Lenght").value,
          Pipe_Roughness: document.getElementById("Pipe_Roughness").value,
        };

        // 2) build payload
        const payload = {
          request: {
            workspaceId: wsIds.workspaceId,
            applicationId: wsIds.applicationId,
            inputs: inputs,
            outputs: ["Pipe_Diameter"],
          },
        };

        try {
          // 3) call API
          const resp = await fetch(wsUrl, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(payload),
          });
          const json = await resp.json();

          // 4) case‐insensitive outputs handling
          const outs =
            json.outputs || (json.response && json.response.outputs);
          const key = Object.keys(outs).find(
            (k) => k.toLowerCase() === "pipe_diameter"
          );
          const val = outs[key];

          // 5) display result
          document.getElementById(
            "output-text"
          ).textContent = `Pipe_Diameter = "D = ${val} in."`;
        } catch (e) {
          console.error(e);
          alert("Error fetching calculation. See console for details.");
        }
      });
  </script>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Example 2: Two-Page Sales Quoting Application

This sales quoting tool is designed for an insurance company to calculate insurance premiums for an artisan contractors program. It takes various inputs such as company information, coverage details including deductibles, occurrence limits, and other related parameters, and generates comprehensive pricing details for the insurance coverage.

ChatGPT Prompt:

I would like to build a single-page application using only HTML, CSS, and JavaScript. The application should allow users to enter a series of inputs, trigger a calculation by calling a SpreadsheetWeb Hub endpoint, and display a series of outputs. 

Target API Endpoint: 
https://private.spreadsheetweb.com/api/calculations/calculatesinglesimple 

Styling: 
Use Bootstrap for styling the page. 

API Structure 
Sample API Request: 
{ 
  "request": { 
    "workspaceId": "YOUR-WORKSPACEID", 
    "applicationId": "YOUR-APPLICATIONID", 
    "inputs": { 
      "AcceptTerrorism": "No", 
      "AdditionalInsured": "0", 
      "Address": null, 
      "City": null, 
      "Code": null, 
      "Deductible": "1000", 
      "DoubleAggregate": "No", 
      "EffectiveDate": null, 
      "Email": null, 
      "NamedInsured": "ABC", 
      "NewVenture": "No", 
      "OccurrenceLimit": "500000", 
      "Payroll": "100000", 
      "Phone": null, 
      "PriorCoverage": "Yes", 
      "State": "AL" 
    }, 
    "outputs": [ 
      "Additional_Insured", 
      "Filing_Fee", 
      "General_Liability", 
      "Policy_Fee", 
      "Taxes_and_Fees", 
      "Terrorism", 
      "Total" 
    ] 
  } 
} 

Sample API Response: 
{ 
  "response": { 
    "outputs": { 
      "Additional_Insured": "0", 
      "Filing_Fee": "12.596", 
      "General_Liability": "3024", 
      "Policy_Fee": "125", 
      "Taxes_and_Fees": "97.619", 
      "Terrorism": "0", 
      "Total": "3259.215" 
    } 
  }, 
  "timingsSeconds": { 
    "hubApiApplication": 0.1099754, 
    "designerApplication": 0.1719786 
  }, 
  "performanceInformation": null, 
  "isError": false, 
  "messages": null 
} 

User Interface Specifications: 
- Inputs should appear on the page using the most appropriate HTML control based on their data type, unless specified otherwise. 
- Outputs must be displayed in a tabular format. 
- Output field names should be read without case sensitivity. 

Specific Input Type Definitions: 

- State: A dropdown listing 2-letter US state abbreviations (e.g., CA for California). 
- Code: A dropdown containing the following options: 
Air Conditioning Repair - Dwelling 
Appliance Repair / Installation 
Cable TV - Installation & Service 
Carpentry - Interior / Shop 
Carpentry - NOC 
Carpet / Rug / Upholstery Cleaning 
Ceiling or Wall Installation 
Chimney Sweeps 
Debris Removal 
Drilling - Water Only 
Driveway / Parking Lot Paving 
Drywall / Wallboard Installation 
Electrical Apparatus Installation 
Electrical Work in Buildings 
Fence Erection 
Floor Covering - No Tile or Stone 
Furniture or Fixture Installation 
Handyman 
House Furnishings Installation 
Insulation 
Interior Decorations 
Janitorial - No Floor Waxing 
Landscape Gardening 
Masonry 
Office Machinery Installation 
Painting, Exterior 
Painting, Interior 
Plastering or Stucco 
Plumbing, Commercial 
Plumbing, Residential 
Septic Cleaning 
Sheet Metal Work, Outside 
Siding Installation 
Sign Erection, Installation, Repair 
Swim Pool Maint. - Above Ground 
Swim Pool Maint. - Below Ground 
Tile, Stone, & Marble Floor 
Tree Trimming 
Upholstering 
Wallpaper Hanging 
Water Softening Equipment 
Window Cleaning 

- PriorCoverage, NewVenture, DoubleAggregate, AcceptTerrorism: Dropdowns containing two options: 
 - Yes 
 - No 

- EffectiveDate: A date picker input. When sent to the API, format it as "yyyy-mm-dd". 

Inputs should be pre-populated with the default values provided in the sample JSON request. 


Buttons and Navigation 
- Include a CALCULATE button. When clicked: 
 - Collect input values. 
 - Send a request to the API endpoint. 
 - Display the returned outputs on a new page or view. 
- Include a BACK button on the outputs page to return to the input form. 

WordPress Theme Compatibility Requirements 
- Write the final HTML/JS code as a single line. 
- Make case-insensitive handling of the outputs section using the logic: outs = json.outputs || (json.response && json.response.outputs) 
- Provide the code as a WordPress page template with remove_filter('the_content','wpautop') at the top.
- Provide the full HTML/JS in a single code block, do not wrap <script> tags in <p> tags.

 

Final ChatGPT-Generated Code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Insurance Calculator</title>
  <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
    rel="stylesheet"
  >
</head>
<body>
  <div class="container py-5">
    <h1 class="mb-4">Insurance Calculator</h1>
    <div class="row g-3">
      <!-- AcceptTerrorism -->
      <div class="col-md-6">
        <label for="AcceptTerrorism" class="form-label">AcceptTerrorism</label>
        <select id="AcceptTerrorism" class="form-select">
          <option value="Yes">Yes</option>
          <option value="No" selected>No</option>
        </select>
      </div>

      <!-- AdditionalInsured -->
      <div class="col-md-6">
        <label for="AdditionalInsured" class="form-label">AdditionalInsured</label>
        <input
          type="number"
          id="AdditionalInsured"
          class="form-control"
          value="0"
        >
      </div>

      <!-- Address -->
      <div class="col-md-6">
        <label for="Address" class="form-label">Address</label>
        <input
          type="text"
          id="Address"
          class="form-control"
          value=""
        >
      </div>

      <!-- City -->
      <div class="col-md-6">
        <label for="City" class="form-label">City</label>
        <input
          type="text"
          id="City"
          class="form-control"
          value=""
        >
      </div>

      <!-- Code -->
      <div class="col-md-6">
        <label for="Code" class="form-label">Code</label>
        <select id="Code" class="form-select"></select>
      </div>

      <!-- Deductible -->
      <div class="col-md-6">
        <label for="Deductible" class="form-label">Deductible</label>
        <input
          type="number"
          id="Deductible"
          class="form-control"
          value="1000"
        >
      </div>

      <!-- DoubleAggregate -->
      <div class="col-md-6">
        <label for="DoubleAggregate" class="form-label">DoubleAggregate</label>
        <select id="DoubleAggregate" class="form-select">
          <option value="Yes">Yes</option>
          <option value="No" selected>No</option>
        </select>
      </div>

      <!-- EffectiveDate -->
      <div class="col-md-6">
        <label for="EffectiveDate" class="form-label">EffectiveDate</label>
        <input
          type="date"
          id="EffectiveDate"
          class="form-control"
        >
      </div>

      <!-- Email -->
      <div class="col-md-6">
        <label for="Email" class="form-label">Email</label>
        <input
          type="email"
          id="Email"
          class="form-control"
          value=""
        >
      </div>

      <!-- NamedInsured -->
      <div class="col-md-6">
        <label for="NamedInsured" class="form-label">NamedInsured</label>
        <input
          type="text"
          id="NamedInsured"
          class="form-control"
          value="ABC"
        >
      </div>

      <!-- NewVenture -->
      <div class="col-md-6">
        <label for="NewVenture" class="form-label">NewVenture</label>
        <select id="NewVenture" class="form-select">
          <option value="Yes">Yes</option>
          <option value="No" selected>No</option>
        </select>
      </div>

      <!-- OccurrenceLimit -->
      <div class="col-md-6">
        <label for="OccurrenceLimit" class="form-label">OccurrenceLimit</label>
        <input
          type="number"
          id="OccurrenceLimit"
          class="form-control"
          value="500000"
        >
      </div>

      <!-- Payroll -->
      <div class="col-md-6">
        <label for="Payroll" class="form-label">Payroll</label>
        <input
          type="number"
          id="Payroll"
          class="form-control"
          value="100000"
        >
      </div>

      <!-- Phone -->
      <div class="col-md-6">
        <label for="Phone" class="form-label">Phone</label>
        <input
          type="tel"
          id="Phone"
          class="form-control"
          value=""
        >
      </div>

      <!-- PriorCoverage -->
      <div class="col-md-6">
        <label for="PriorCoverage" class="form-label">PriorCoverage</label>
        <select id="PriorCoverage" class="form-select">
          <option value="Yes" selected>Yes</option>
          <option value="No">No</option>
        </select>
      </div>

      <!-- State -->
      <div class="col-md-6">
        <label for="State" class="form-label">State</label>
        <select id="State" class="form-select"></select>
      </div>
    </div>

    <button id="calculate-btn" class="btn btn-primary mt-4">
      CALCULATE
    </button>

    <p id="output-text" class="fs-4 mt-4"></p>
  </div>

  <script>
    const wsUrl = "https://private.spreadsheetweb.com/api/calculations/calculatesinglesimple",
          wsIds = {
            workspaceId: "12d7c758-b138-426d-83a2-2e9cc73a5a4e",
            applicationId: "f4c19e1f-3f40-481f-b57d-c1f483386310"
          };

    const codes = [
      "Air Conditioning Repair - Dwelling",
      "Appliance Repair / Installation",
      "Cable TV - Installation & Service",
      "Carpentry - Interior / Shop",
      "Carpentry - NOC",
      "Carpet / Rug / Upholstery Cleaning",
      "Ceiling or Wall Installation",
      "Chimney Sweeps",
      "Debris Removal",
      "Drilling - Water Only",
      "Driveway / Parking Lot Paving",
      "Drywall / Wallboard Installation",
      "Electrical Apparatus Installation",
      "Electrical Work in Buildings",
      "Fence Erection",
      "Floor Covering - No Tile or Stone",
      "Furniture or Fixture Installation",
      "Handyman",
      "House Furnishings Installation",
      "Insulation",
      "Interior Decorations",
      "Janitorial - No Floor Waxing",
      "Landscape Gardening",
      "Masonry",
      "Office Machinery Installation",
      "Painting, Exterior",
      "Painting, Interior",
      "Plastering or Stucco",
      "Plumbing, Commercial",
      "Plumbing, Residential",
      "Septic Cleaning",
      "Sheet Metal Work, Outside",
      "Siding Installation",
      "Sign Erection, Installation, Repair",
      "Swim Pool Maint. - Above Ground",
      "Swim Pool Maint. - Below Ground",
      "Tile, Stone, & Marble Floor",
      "Tree Trimming",
      "Upholstering",
      "Wallpaper Hanging",
      "Water Softening Equipment",
      "Window Cleaning"
    ];

    const states = [
      "AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL",
      "IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT",
      "NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI",
      "SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
    ];

    // Populate Code dropdown
    const codeSelect = document.getElementById("Code");
    codeSelect.innerHTML = '<option value="" selected>Select Code</option>';
    codes.forEach(c => {
      const o = document.createElement("option");
      o.value = c;
      o.text = c;
      codeSelect.appendChild(o);
    });

    // Populate State dropdown
    const stateSelect = document.getElementById("State");
    states.forEach(s => {
      const o = document.createElement("option");
      o.value = s;
      o.text = s;
      if (s === "AL") o.selected = true;
      stateSelect.appendChild(o);
    });

    // Calculate button handler
    document
      .getElementById("calculate-btn")
      .addEventListener("click", async () => {
        const inputs = {
          AcceptTerrorism: document.getElementById("AcceptTerrorism").value,
          AdditionalInsured: document.getElementById("AdditionalInsured").value,
          Address: document.getElementById("Address").value,
          City: document.getElementById("City").value,
          Code: document.getElementById("Code").value,
          Deductible: document.getElementById("Deductible").value,
          DoubleAggregate: document.getElementById("DoubleAggregate").value,
          EffectiveDate: document.getElementById("EffectiveDate").value,
          Email: document.getElementById("Email").value,
          NamedInsured: document.getElementById("NamedInsured").value,
          NewVenture: document.getElementById("NewVenture").value,
          OccurrenceLimit: document.getElementById("OccurrenceLimit").value,
          Payroll: document.getElementById("Payroll").value,
          Phone: document.getElementById("Phone").value,
          PriorCoverage: document.getElementById("PriorCoverage").value,
          State: document.getElementById("State").value
        };

        const payload = {
          request: {
            workspaceId: wsIds.workspaceId,
            applicationId: wsIds.applicationId,
            inputs: inputs,
            outputs: [
              "Additional_Insured",
              "Filing_Fee",
              "General_Liability",
              "Policy_Fee",
              "Taxes_and_Fees",
              "Terrorism",
              "Total"
            ]
          }
        };

        try {
          const resp = await fetch(wsUrl, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(payload)
          });
          const json = await resp.json();
          const outs = json.outputs || (json.response && json.response.outputs) || {};

          document.getElementById("output-text").textContent = Object
            .entries(outs)
            .map(([k, v]) => `${k}: ${v}`)
            .join(", ");
        } catch (e) {
          console.error(e);
          alert("Error fetching calculation");
        }
      });
  </script>

  <script
    src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
  ></script>
</body>
</html>

Summary

Leveraging ChatGPT and SpreadsheetWeb allows rapid transformation of Excel models into powerful, interactive web applications. By carefully structuring your prompts and integrating SpreadsheetWeb's robust calculation API, anyone can embed professional-grade tools directly onto their website.