Automate Excel With Python Using xlwings Lite and Webhooks
xlwings Lite runs Python inside Excel without a local Python install, so a workbook becomes the front end for automation: a button runs a short script, and the script sends the data to a no-code tool such as Pabbly Connect, which sends the email, builds the invoice or publishes the survey. No VBA and no paid plugins.
Table of contents
Why Excel
Excel is already on every desk, people know how to type into cells and press buttons, and the data usually lives there anyway. That makes a workbook a practical front end for small internal tools: no training, no data migration and no server to maintain.
The interface is ordinary formatting. Merged cells, colors and tables are enough to build a clear input form or a small dashboard. The logic moves to Python and to an automation platform, so the workbook stays simple for the people who use it.
Four demo tools
I built four small tools on the same pattern: the sheet holds the inputs, a button runs a Python script, and the script either changes the workbook or sends the data to a webhook.
Bulk personalized email sender
A bike shop wants to tell customers about price changes. The sheet stores the contact person, product, old price, new price, effective date and email address. Formulas build each subject and body by combining the product name and the date. One button sends every email, personalized for each row. For a ready-made app that sends personalized emails from a spreadsheet, see SheetCourier.

Invoice generator
The sheet holds the company details, billing address, invoice number, date, payment terms and an items table. Formulas calculate the due date (invoice date plus 7 days) and the line totals. The Create Invoice button sends everything to the automation platform, which builds the PDF, saves it to cloud storage and writes a download link back into the sheet. If you would rather build documents with plain Python, see how to create Word and PDF documents from Excel data.

Web survey
After a training session you want feedback. You type the survey title and the questions into the sheet and click Create Survey. The workflow publishes a live survey page and returns its link. Responses land in a database such as Google Sheets or Airtable, and a second button fetches them back into Excel for analysis. I cover the no-code side of this in sending Excel data to other apps with a webhook.

Automating Excel itself
Not every script needs another app. One button inserts a new sheet with a formatted agenda: a bold title, a link to the presentation and a numbered list. Small tasks like this save repeated clicks. I show more of these one-click workflows in automating repetitive Excel work with Python.

Install xlwings Lite
xlwings Lite is a free Excel add-in that runs Python in the browser engine inside Excel, so you do not need Python installed on your computer. You install it from the add-in store and write the code in its own task pane.
-
Open a new Excel workbook.
-
Go to Home > Add-ins and search for xlwings Lite.
-
Add it to the workbook. A new xlwings Lite icon appears on the ribbon.
-
Click the icon to open the code pane with the example scripts.
Functions decorated with @script run only when you trigger them, for example from the run button or a sheet button. Through the book argument you get the sheets, cells and ranges of the workbook, and the editor offers code suggestions as you type. The first example writes Hello World into A1 and colors the cell:
import xlwings as xw
from xlwings import script
@script
def hello_world(book: xw.Book):
# Scripts require the @script decorator and the type-hinted
# book argument (book: xw.Book)
cell = book.sheets.active["A1"]
cell.value = "Hello World!"
cell.color = "#FFFF00" # yellow
My xlwings Lite guide covers the task pane, packages and custom functions in more detail.
Send data to a webhook
The Python part stays small. The script reads a few cells, packs them into JSON and posts them to a webhook URL. An automation platform receives the data and does the actual work, such as sending the email through Gmail.
For a single email, the sheet needs three input cells: receiver, subject and body. Give each cell a named range instead of using its address in the code. If you insert rows or columns later, the names move with the cells and the script keeps working.
The script then:
- reads the values from the named ranges,
- packs them into a JSON object,
- sends it with a POST request to the webhook URL of your automation tool.
Add the requests package in the requirements tab of xlwings Lite so the script can send HTTP requests.
On the platform side, a workflow starts when the webhook receives data. I use Pabbly Connect; Zapier and Make work the same way. The workflow can send an email, generate an invoice or build a web page, and it can send a result back to Excel, such as a success message or a download link.
Affiliate link: if you buy Pabbly Connect through it, I may earn a commission, at no extra cost to you.

Add a button
A button lets anyone run the script without opening the code pane. Insert a shape, label it, and link it to a cell. The button argument of the @script decorator then names the shape in brackets, followed by that cell, and a click on the shape runs the function.

The invoice script
Every demo script follows the same steps: read the inputs from named ranges, tidy them (parse dates, turn the items table into a list), and post them to a Pabbly Connect workflow. The invoice workflow returns a link to the finished PDF.
Here is the first part of the invoice script. The decorator ties it to the button on the sheet, and every value comes from a named range:
@script(button="[btnCreateInvoice]Create_Invoice!B15", show_taskpane=False)
def create_invoice(book: xw.Book):
"""Generate and send invoice data to webhook for PDF creation."""
# === SETTINGS ===
webhook_url = os.getenv("INVOICE_WEBHOOK_URL")
# ================
if not webhook_url:
book.sheets.active["download_url"].value = "Error: INVOICE_WEBHOOK_URL not set"
return
# Read invoice data from named ranges
invoice_data = {
"from": book.names["from_name"].refers_to_range.value,
"to": book.names["to_name"].refers_to_range.value,
"number": int(book.names["invoice_number"].refers_to_range.value),
"notes": book.names["notes"].refers_to_range.value,
"terms": book.names["terms"].refers_to_range.value,
}
The webhook URL comes from an environment variable instead of the code, so you can share the workbook without sharing the URL. If the variable is missing, the script writes an error into the sheet and stops. The survey script builds the page HTML in Python and shortens the survey link with a URL shortener before writing it to the sheet, because a full link is too long to handle comfortably in a cell.
Limits
This pattern suits small internal tools, not large systems. The heavy lifting happens on the automation platform, so every button click is a task there and counts against the limits of your plan.
- The workflows need an internet connection and a active automation account. Offline, a click only produces an error.
- Anyone who has the webhook URL can send data to the workflow. Keep it in an environment variable, as in the invoice script, and do not paste it into a cell.
- For tasks that only touch the workbook (the agenda example), no platform is needed at all.
If you want a guided path from here, my Excel Automation Course teaches Python for Excel users with xlwings Lite.
