We tested it · 8 min read

Python without coding: two free AIs wrote scripts to merge 12 Excel files. Both reports came out as zero

কোড না জেনে পাইথন: দুটি এআই-র স্ক্রিপ্ট, দুটোতেই মোট বিক্রি শূন্য

Free Gemini and Copilot wrote scripts to merge 12 messy sales files. Both crashed, then “succeeded” with every amount at zero. Here is a script that works.

“I can’t code” is no longer a reason not to automate. Ask an AI for a Python script, paste it, run it. We tested that with a job every accountant has: 12 monthly sales files, one per month, to be combined and totalled by product and by month.

The files are as messy as real ones: a column order that changes in October, a title above the header in December, a CSV in January, text numbers in March, returns in April, and untidy product names in May. Every file ends with a Total row. Try the puzzle first.

The puzzle

What we asked
Copilot, free. The error message pasted back: “KeyError: 'Column not found: Amount'. Please fix the script and send the full corrected version.” Then the script was run.
What the fixed script printed (word for word)
Using Date column    : Date
Using Product column : Product
Using Amount column  : Product name

SUCCESS!

It said SUCCESS. Every amount in the report was 0. What happened?

Show the answer

A script that crashes is better than one that succeeds with nothing. The first scripts at least stopped. The “fixed” ones guessed, and produced a clean-looking report of zeros.

Gemini did the same: its fixed script printed “Done!” with every amount at 0. Both reports lost December completely, because the title above December’s header was read as the header.

The scorecard

Gemini (free)Copilot (free)
First script runs?✗ Crashed: Column not found: Amount✗ The same error
After the error was pasted back“Done!” with every amount 0“SUCCESS!” with every amount 0
Right total (Tk 1,48,02,810)✗✗
Products in the report (right: 8)25 (capital letters, spaces, and a “Total” product)25
Months in the report (right: 12)18 rows: December missing; months such as 2026-07 to 2026-12 that never happened; an “Unknown Date” row17: December missing; including Aug-2026 to Dec-2026
Steps for WindowsClear: the script and the folder side by sideClear, but you must edit a folder path
Warned about different column namesIn its tips, but guessedOffered a “more robust version”

ChatGPT, tested separately, failed the best. Both its first scripts (on two accounts) crashed, but with a message that named the file and the missing columns (“Sales_Apr-2026.xlsx is missing columns: ['Unit price', 'Amount']”), instead of guessing. We could not capture its corrected scripts to run them, so we do not score ChatGPT in the table.

The steps for running a script, the part a beginner needs most, were good from both. The scripts were the problem, and they failed for one reason: the AI wrote a script for the files it imagined, not the files we have. Copilot even began with “Since all 12 files have the same columns …”. They don’t.

What our files did to the scripts

FileThe messWhat a working script does
OctoberColumns in a different order, and “Product name”Find each column by its name, and accept both names
DecemberA title and a blank line above the headerLook for the row that says “Date”
JanuaryA CSV, with dates like 13/01/2026Read it as text, day first
FebruaryA blank row in the middleDrop rows with no date
MarchNumbers typed as text, with lakh commas: “1,25,000”Strip the commas, then convert
AprilReturns as negative quantitiesKeep the minus signs
May“carton 5-ply ” and “ CARTON 5-PLY”Trim spaces and ignore capitals
Every fileA “Total” row at the bottomDrop it, or every month is counted twice

The Total rows alone would have turned Tk 1,48,02,810 into Tk 2,96,05,620.

A script that works on these files

After seeing how both failed, we wrote one that handles each of the problems above, and ran it on a copy of the files. It reads 1,209 sales lines, 8 products and 12 months, and the grand total is Tk 1,48,02,810, equal to our key for every product and every month. It stops with a message if any amount cannot be read, instead of carrying on.

This is our script, written after the tests, not a result from either free AI. It shows what the AI would have needed to be told.

How to run it on Windows
1. Install Python from python.org. Tick "Add python.exe to PATH".
2. Open Command Prompt and type:  pip install pandas openpyxl
3. Unzip the 12 files so you have a folder named "Padma sales 2025-26" next to the script.
4. In that folder's address bar, type cmd, then:  python combine_sales_working.py
5. Open Padma_sales_summary.xlsx. The last lines on screen show the grand total. Compare it with a figure you know.

How to ask AI for a script

  1. Show it the files, not a description. Paste the column names and the first five rows of each different kind of file. This is the step that would have saved both scripts. (We did not re-run the test this way; try it on the practice files.)
  2. Ask it to stop and say so when a column or a date cannot be read, instead of guessing.
  3. Ask for a check line at the end: the number of rows and the grand total.
  4. Run it on a copy and check the total against a figure you know before you use a single number.
  5. Read the lines it prints. “Using Amount column: Product name” was on the screen, and was the whole story.

Lesson: AI and Excel

Free downloads

Learn the skill

Sources

  1. pandas.read_excel (opens in a new tab) pandas documentation
  2. Data analysis with ChatGPT (opens in a new tab) OpenAI Help Center
  3. Attach & analyze files in Gemini Apps (opens in a new tab) Gemini Apps Help

More trends & tests

See all

Educational content only. AI tools change often: check the tool’s own help pages, and check every AI answer, especially numbers, tax rates and references, before you rely on it.