# Project export: LeXcel

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: TreeHacks 2025
- Tagline: The Copilot of Spreadsheets - Natural Language Formula & Plot Assistant for Google Sheets
- Devpost: https://devpost.com/software/lexcel
- GitHub: https://github.com/liunicholas/LeXcel
- Video: https://www.youtube.com/embed/6_GAEqMF_2A?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 1 GitHub contributor(s) — Nicholas Liu (15 commits)

## Devpost submission (written by the team)

### Inspiration

Spreadsheets are powerful but often frustrating tools. They require users to memorize complex formulas and spend time on tedious formatting, leading to a slow and efficient process. We wanted to create a solution that enhances productivity, reduces errors, and makes spreadsheets smarter and more intuitive.

### What it does

LeXcel is an AI-powered add-on that enhances traditional spreadsheets by: Simplifying complexity – Enables users to generate complex formulas using natural language prompts Eliminating tedious formatting – Structures and formats new data given user requests Iterating With Verification – Learn from previous mistakes to produce consistent and robust solutions

### How we built it

We developed LeXcel as a seamless add-on in Google Sheets that is easy to download and run for anyone: no coding experience required. Our main tech stack is javascript, google script, sheetAPI, OpenAI, and Gemini.

### Challenges we ran into

Ensuring AI suggestions are accurate and context-aware for different spreadsheet use cases Building a UI/UX that integrates seamlessly without disrupting existing workflows

### Accomplishments we're proud of

Built a user-friendly AI-powered assistant that significantly reduces the time needed for spreadsheet tasks Successfully implemented real-time error detection and reasoning to fix its own errors

### What we learned

There is a tradeoff between AI automatically inputting all formulas which may feel like magic, versus prompting the user for confirmation which could lead to more consistent results

### What's next

Allow LeXcel to manipulate delete/insert rows, move data around, etc. Give LeXcel the ability to generate and execute multi-step computations Tackle more complex puzzles and Excel World Championship tasks Integrating with more spreadsheet platforms beyond Google Sheets such as Paradigm and Excel

## README (from the GitHub repository)

# 📊 LeXcel - Natural Language Formula Assistant for Google Sheets 🤖

LeXcel is a Google Sheets add-on that transforms the way you work with spreadsheet formulas. Instead of memorizing complex formula syntax, simply describe what you want to do in plain English, and LeXcel will generate and insert the appropriate formula for you! ✨

## ⭐ Features

- 💬 **Natural Language Input**: Describe your formula needs in plain English
- 🔮 **Smart Formula Generation**: Automatically converts your description into proper Google Sheets formulas
- 🧠 **Context-Aware**: Takes into account your selected cells and surrounding data
- 📐 **Range Support**: Works with both single cells and ranges
- ✨ **Auto-Fill**: Automatically extends formulas across selected ranges
- 🎯 **Interactive UI**: Clean, modern interface with real-time feedback
- 🎨 **Range Selection**: Easy cell range insertion with visual selector

## 🚀 How to Use

1. Open LeXcel from the Add-ons menu
2. Select the cell or range where you want to insert a formula and click the 📌 button to insert the selected range
3. Type your request in natural language (e.g., "calculate the average of the numbers to the left")
4. Click Send or press Enter
5. LeXcel will generate and insert the appropriate formula ✅

### 💡 Example Requests

- "Sum all numbers in column A"
- "Find the highest value in the selected range"
- "Calculate the percentage change between these two columns"
- "Count how many times 'Completed' appears in status column"
- "Create a VLOOKUP to match these employee IDs with their names"

## ⚙️ Installation

1. Open Google Sheets
2. Go to Extensions → App Scripts
3. Add the Chatbot.gs and ChatbotUI.html files
5. Grant the necessary permissions

## 💪 Tips for Best Results

- ✍️ Be specific in your descriptions
- 📝 Include relevant context about your data
- 🎯 Use the range selector (📌) to specify exact cell ranges you want to input
- ✅ Review the generated formula before proceeding with other operations

## 📋 Requirements

- 👥 A Google Workspace account
- 📊 Google Sheets access
- 🌐 Internet connection

## 🔒 Privacy & Security

- 🛡️ LeXcel processes all requests securely
- 🗑️ No data is stored permanently
- 🔐 Operates within Google's security framework
- ⚡ Requires minimal permissions to function

---

Made with ❤️ for spreadsheet users who prefer plain English to formula syntax. 

## Detected evidence (automated analysis)

Indexed codebase: 2 recognized source files, 29 KB.
- HTML (language) — detected in the code
- JavaScript (language) — claimed on Devpost, not found in the code
- OpenAI (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (3 of 3)

```
LeXcel.gs
LeXcelUI.html
README.md
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Update LeXcel.gs
- Update LeXcel.gs
- Update LeXcel.gs
- fixed regeneration
- 2:37pm functional
- Update README.md
- add readme
- added loading animation for getting selected range
- Update Chatbot.gs
- 2/15 8:44am functional
- 2:47am update
- 2/15 1:51am save
- push for save
- Update Chatbot.gs
- initial progress on chatbot

## Key source files (fetched from GitHub, selected and truncated for size)

### LeXcelUI.html

```html
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LeXcel Assistant</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link
        href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600&family=Roboto+Mono:wght@400;500&display=swap"
        rel="stylesheet">

    <style>
        body,
        h1,
        h2,
        h3,
        h4,
        h5,
        h6,
        p,
        button,
        input,
        textarea,
        #chat-box,
        #user-text {
            font-family: 'IBX Plex Sans', monospace;
        }

        h3 {
            font-weight: 600;
            color: #7C3AED;
        }

        #chat-box p {
            font-size: 14px;
            line-height: 1.6;
        }

        button {
            font-weight: 500;
            font-size: 14px;
        }

        #user-text {
            font-size: 14px;
            line-height: 1.5;
        }

        #help-button {
            background: none;
            /* Remove background color */
            border: none;
            /* Remove border */
            cursor: pointer;
            padding: 8px;
            /* Minimal padding */
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #help-button i {
            font-size: 23px;
            /* Set correct size */
            color: #7C3AED;
            /* Set icon color */
            transition: color 0.2s, transform 0.2s;
        }

        #help-button:hover i {
            color: #6D28D9;
            /* Change color on hover */
            transform: scale(1.1);
            /* Slightly enlarge on hover */
        }



        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            padding: 20px;
            background-color: #FAF9F7;
            color: #2D2D2D;
            margin: 0;
            height: 100vh;
            display: flex;
            flex-direction: column;
            max-width: 1000px;
            margin: 0 auto;
        }

        h3 {
            margin: 0 0 15px 0;
            color: #7C3AED;
            font-weight: 500;
        }

        #chat-box {
            flex: 1;
            max-height: 80vh;
            overflow-y: auto;
            border: 1px solid #E5E7EB;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            background-color: white;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            position: relative;
        }

        #chat-box p {
            margin: 8px 0;
            line-height: 1.5;
        }

        #chat-box strong {
            color: #7C3AED;
        }


        #text-input-container {
            display: flex;
            gap: 8px;
            width: 100%;
            padding: 10px;
            border: 1px solid #E5E7EB;
            border-radius: 6px;
            background-color: white;
            align-items: flex-start;
            min-height: 40px;
        }

        #user-text {
            flex-grow: 1;
            border: none;
            outline: none;
            font-size: 14px;
            min-height: 20px;
            max-height: 200px;
            overflow-y: auto;
            white-space: pre-wrap;
            word-break: break-word;
            line-height: 1.5;
        }

        .tag {
            display: inline-flex;
            align-items: center;
            background-color: #EDE9FE;
            color: #7C3AED;
            padding: 0px 6px;
            border-radius: 4px;
            margin: 2px;
            font-size: 14px;
        }

        .tag .remove-btn {
            margin-left: 6px;
            cursor: pointer;
            font-weight: bold;
            color: #6D28D9;
        }

        /* Ensure buttons align properly */
        .input-container {
            display: flex;
            gap: 8px;
            margin-top: 10px;
            flex-shrink: 0;
            /* Prevents shrinking */
            justify-content: space-between;
            align-items: center;
        }

        /* Fix "Insert Selected Range" button */
        .input-container button:first-child {
            flex: 1;
            min-width: 160px;
            /* Ensure it doesn't shrink */
            padding: 8px 12px;
            background-color: #F3F0FF;
            color: #7C3AED;
            border: 1px solid #E5E7EB;
            border-radius: 6px;
            font-size: 12px;
            white-space: nowrap;
        }

        /* Fix "Send" button to be a small circle */
        #send-button {
            width: 32px;
            height: 32px;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #7C3AED;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            transition: background-color 0.2s, transform 0.2s;
            flex-shrink: 0;
        }

        /* Fix icon inside the button */
        #send-button i {
            font-size: 18px;
            color: white;
        }

        /* Hover effect for the send button */
        #send-button:hover {
            background-color: #6D28D9;
            transform: scale(1.1);
        }


        button {
            padding: 8px 16px;
            background-color: #7C3AED;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: background-color 0.2s;
       
[truncated — 21256 more characters]
```