Button guide

Automate an Excel report with Python and let colleagues run it themselves a pandas script plus a Run button

To automate an Excel report with Python and hand it off to your team, write a script using pandas and openpyxl that accepts the raw data file and report parameters as command-line arguments, then publish that script as a web form with Button (https://button.bitgate.dev). Your colleagues open a link, upload their raw export, pick the month, and download the finished .xlsx workbook without installing Python or touching the command line. Button's Free plan is $0 for 1 published tool, up to 3 invited colleagues, and 100 runs per month (with files up to 25 MB each), while Pro is $15/month for 50 tools and 250 people.

Write the report script with pandas and openpyxl

If you already build the report in a Jupyter notebook or a script with hard-coded file paths, you only need to change how inputs and outputs are handled. Instead of hard-coding paths or using interactive input() prompts, use Python's argparse module so the script takes the input file path, the month, and the output folder path as command-line arguments.

Here is a short script that reads a raw CSV export, filters it to the chosen month, aggregates the numbers, and uses openpyxl via the pandas ExcelWriter to format the output workbook.

import argparse
from pathlib import Path
import pandas as pd

parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--month", required=True)
parser.add_argument("--output-dir", required=True)
args = parser.parse_args()

df = pd.read_csv(args.input_file)
df = df[df["Month"] == args.month]

summary = (
    df.groupby("Department", as_index=False)["Amount"]
    .sum()
    .sort_values("Amount", ascending=False)
)

out_path = Path(args.output_dir) / f"report_{args.month}.xlsx"

with pd.ExcelWriter(out_path, engine="openpyxl") as writer:
    summary.to_excel(writer, sheet_name="Summary", index=False)
    df.to_excel(writer, sheet_name="Raw Data", index=False)

    sheet = writer.sheets["Summary"]
    sheet.column_dimensions["A"].width = 24
    sheet.column_dimensions["B"].width = 16

The script writes the .xlsx into the folder passed as --output-dir. Fixed flags like --input-file and --month are part of the command you approve on your machine; your colleagues only supply the values for the form fields.

Turn the script into a web form with Button

Button turns a script on your own computer into a web form your colleagues can run. Jobs run on your computer (where your Python environment and packages already live), never in Button's cloud, while Button's servers relay the form values and files between the browser and your machine.

  1. Sign in at https://button.bitgate.dev.
  2. Install the Button runner on your computer (macOS, Linux, or Windows) by running the one-line command the site shows you - it's a curl command on macOS and Linux, or PowerShell on Windows.
  3. Open the local setup page and pick your Python script.
  4. Describe the inputs so Button knows what form fields to show:
    • A file upload field for the raw export (--input-file).
    • A choice or text field for the month (--month).
  5. Approve the command on your computer and publish.

Once you publish, Button gives the tool its own web page and pins the exact command you approved by hash. Every form value a colleague enters is passed to your program as its own argument, with no shell, and a value can't start with - (so someone typing into a text field cannot inject an unexpected flag into your script). If you edit the tool later, people have to confirm the new version before running it.

To hand it off, invite your colleagues by email. They open the link from their invite email, sign in with Google or a one-time email code, upload their export, pick the month, and press Run. When the script finishes, they download the formatted workbook straight from the page. They install nothing and never pay.

You get a log of every run showing who ran it and when, and you can revoke someone's access or set it to expire at any time.

What to know about limits and pricing

Because jobs run on your computer, your machine has to be on and online when someone needs the report. The tool page shows your colleagues whether your computer is Ready, Busy, or Offline, and it runs one job at a time. Each workspace pairs with one computer on every plan (pairing a new computer replaces the previous one).

Here is how the plans and operational limits break down:

Limit or feature Free ($0) Pro ($15/month, or $144/year at $12/month)
Published tools 1 50
Invited people (you don't count) 3 250
Runs per month (includes your own runs) 100 5,000
File transfer per month 1 GB 50 GB
Max file size 25 MB per file (up to 8 files and 100 MB per run) 25 MB per file (up to 8 files and 100 MB per run)
Max run duration and log size 30 minutes per run; 1 MB logs per run 30 minutes per run; 1 MB logs per run
File retention Inputs deleted after 24 hours, outputs after 7 days Inputs deleted after 24 hours, outputs after 7 days

If you ever downgrade from Pro to Free, nothing is deleted.

When to use Power Query, VBA, or Python in Excel instead

Putting a web form in front of a local Python script isn't always the right setup. Sometimes the logic belongs inside the workbook itself.

Power Query or VBA is the better choice when the report should stay entirely inside Excel and you don't need Python libraries at all. If your colleagues are already working inside a shared template and just need to refresh a data connection or click a macro button to clean up a table, keeping it in Power Query or VBA means the workbook is self-contained and doesn't depend on your computer being online.

Python in Excel (available in Microsoft 365 Business and Enterprise on Windows, Excel on the web, and Excel for Mac, with some consumer plans in preview and a paid add-on for premium compute) lets you write Python formulas directly in cells. It is a good fit when you want pandas calculations embedded inside a live sheet that other Microsoft 365 users edit. Its limits:

  • Your code runs in a container in the Microsoft Cloud with a curated set of Anaconda libraries, and you can't pip install other packages.
  • That container has no access to your computer's local files or devices, and no network access.

Use Button when your script needs packages outside that curated Anaconda list, needs to read files or resources on your machine, or when you want colleagues to get a clean, finished .xlsx file from a browser form without touching the workbook's internals.

FAQ

Do my colleagues need Python or a paid Button account to run the report?

No. They just open the link from their invite email in a browser, sign in with Google or a one-time email code, fill in the form, and press Run. Recipients never pay and never install anything.

Where does my Python script actually run, and where do the files go?

The script runs on your own computer, never in Button's cloud. Form values and uploaded or generated files pass through Button's servers to get between your colleague's browser and your machine, and Button deletes inputs 24 hours after a run ends and outputs after 7 days.

What happens if my computer is asleep or I'm already running a job?

Because jobs execute on your machine, it must be on and online for colleagues to run the tool. The tool's page shows Ready, Busy (since one run happens at a time per computer), or Offline so people know right away if your machine is available.

Can a colleague change what the script does by typing flags into the form?

No. The runner only executes the exact command you approved on your computer (pinned by hash), passes every form value as its own argument without a shell, and blocks values that start with -.

Does Button only work with Python scripts?

No, any program you can run from a command line works. You can use Python, Node, R, PowerShell, shell scripts, or compiled binaries.

Last updated

Put your script behind a form

Button turns a script on your computer into a web form. Colleagues sign in, fill it in, press Run and download the results. Free for 1 tool and 3 people.