Create an Excel Data Entry Form With Python and ChatGPT
An Excel data entry form built without hand-writing code: the interface is drawn in Figma, converted to Python automatically, and the behaviour behind each button is generated by ChatGPT. The finished form is then packaged as a standalone app.
Design the form in Figma
The form is drawn in Figma with plain rectangles, text and an image. What matters most is the layer names, because Tkinter Designer turns layers into widgets based on their names: “Button”, “TextBox” and “Image”.
-
Create a frame. On figma.com, add a frame of 650 by 350 pixels. Draw a dark blue rectangle for the background and a second rectangle for the header.
-
Add the header image and title. Drag an image onto the canvas and move its layer above the background. Add the form title as a text element and set its size and weight. Text can shift after conversion, so resize the text box to fit its content.
-
Draw the input fields. Each field is a text label plus a light yellow rectangle with rounded corners. Select both and press Ctrl+D to duplicate them for first name, last name, email and the other fields.
-
Draw the submit button. Use a light red rectangle with centered text, then group the two.
-
Rename the layers. Name the button group “Button”, the input rectangles “TextBox” and the image “Image”. Remove the numbers Figma adds to the background rectangles.

Convert the design to Python
Tkinter Designer reads the Figma file and writes a Python script plus an assets folder. Use a virtual environment with Python 3.10, because the package had dependency problems on newer versions when I recorded this.
pip install tkdesigner
Run TkDesigner from the command line with the URL of your Figma design (from the Share button) and a personal access token, which you create in your Figma account settings. If the URL is rejected, change “design” to “file” in the link.
The command creates a build folder with the converted Python file. Run it, and the form appears with the yellow rectangles turned into text input fields. I cover Tkinter Designer itself in more detail in creating Python GUIs with drag and drop.

Add the save logic with ChatGPT
The generated form does nothing yet, so the next step is the code that saves each entry to a spreadsheet. ChatGPT writes it from one detailed prompt. The GUI uses Tkinter, which ships with Python, and the same approach works for saving to a database or Google Sheets instead.
This is the top of the generated file:
from pathlib import Path
# from tkinter import *
# Explicit imports to satisfy Flake8
from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path(r"C:\path\to\build\assets\frame0")
def relative_to_assets(path: str) -> Path:
return ASSETS_PATH / Path(path)
window = Tk()
window.geometry("650x350")
window.configure(bg = "#FFFFFF")
Further down, the generated file creates the submit button. Its command option sets the action for the button click, which currently just prints button_1 clicked to the terminal. I asked ChatGPT to replace it with real logic:
“Adjust the Excel data entry form to save submissions to submissions.xlsx using OpenPyXL. Create the file if it doesn’t exist and assign an auto-incremented ID to each submission. After submitting, clear all fields and display a success message. Ensure all fields are filled, show an error if any are empty, and validate the email before submitting.”
ChatGPT returns three functions: one checks the email format, one appends a row to submissions.xlsx (and creates the file with headers on the first run), and one reads the six fields, validates them and clears the form. This is the version in the GitHub repo:
def validate_email(email):
# Simple regex for email validation
return re.match(r"[^@]+@[^@]+\.[^@]+", email) is not None
def save_to_excel(data):
file_path = OUTPUT_PATH / "submissions.xlsx"
if not file_path.exists():
workbook = openpyxl.Workbook()
sheet = workbook.active
sheet.append(
[
"ID",
"First Name",
"Last Name",
"Phone No.",
"Company",
"E-Mail",
"Job Title",
]
)
workbook.save(file_path)
else:
workbook = openpyxl.load_workbook(file_path)
sheet = workbook.active
current_id = sheet.max_row # ID will be the current row number
data.insert(0, current_id) # Insert ID at the beginning of the data list
sheet.append(data)
workbook.save(file_path)
def submit_form():
first_name = entry_1.get()
last_name = entry_3.get()
phone_no = entry_2.get()
company = entry_4.get()
email = entry_5.get()
job_title = entry_6.get()
if not (first_name and last_name and phone_no and company and email and job_title):
messagebox.showerror("Error", "All fields are required.")
return
if not validate_email(email):
messagebox.showerror("Error", "Invalid email format.")
return
data = [first_name, last_name, phone_no, company, email, job_title]
save_to_excel(data)
messagebox.showinfo("Success", "Submission saved successfully!")
# Clear all fields after successful submission
entry_1.delete(0, "end")
entry_2.delete(0, "end")
entry_3.delete(0, "end")
entry_4.delete(0, "end")
entry_5.delete(0, "end")
entry_6.delete(0, "end")
The submit button then calls the new function with command=submit_form instead of the print statement.
With the code pasted in, the form saves each submission and shows a confirmation message. Empty fields and a malformed email address are rejected with an error.

Package it as an exe
PyInstaller turns the script into an executable that runs without Python installed. First the path settings need a change: inside a PyInstaller bundle the assets live in a temporary folder, so the script checks whether it runs frozen and picks the right path.
from pathlib import Path
from tkinter import Tk, Canvas, Entry, Button, PhotoImage, messagebox
import openpyxl
import re
import sys
# Determine if the script is running in a PyInstaller bundle
if getattr(sys, "frozen", False):
OUTPUT_PATH = Path.cwd()
ASSETS_PATH = Path(sys._MEIPASS) / "assets/frame0"
else:
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / "assets/frame0"
def relative_to_assets(path: str) -> Path:
return ASSETS_PATH / Path(path)
pip install pyinstaller
Then install PyInstaller and build the exe. The --add-data option bundles the images from the assets folder:
pyinstaller --onefile --windowed --add-data "assets;assets" gui.py
On macOS and Linux, write assets:assets instead. The exe lands in the dist folder and saves submissions.xlsx to the folder it runs from.

If you want a form without designing it in Figma, my free Python Excel data entry form builder generates a complete desktop app that saves to Excel, with search, edit and delete built in.
