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
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.
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?
-
No. The 12 files hold 1,209 sales lines worth Tk 1,48,02,810.
-
Right. Our column is called “Amount (Tk)”, which was not on its list of names. Its fallback was “if still not found, use last column”. That was a product-name column, and summing text gives 0. The line saying so is easy to miss.
-
They were too (it printed months like Aug-2026 that never happened), but that does not make the amounts zero.
-
No. The script did write its workbook.
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” row | 17: December missing; including Aug-2026 to Dec-2026 |
| Steps for Windows | Clear: the script and the folder side by side | Clear, but you must edit a folder path |
| Warned about different column names | In its tips, but guessed | Offered 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
| File | The mess | What a working script does |
|---|---|---|
| October | Columns in a different order, and “Product name” | Find each column by its name, and accept both names |
| December | A title and a blank line above the header | Look for the row that says “Date” |
| January | A CSV, with dates like 13/01/2026 | Read it as text, day first |
| February | A blank row in the middle | Drop rows with no date |
| March | Numbers typed as text, with lakh commas: “1,25,000” | Strip the commas, then convert |
| April | Returns as negative quantities | Keep the minus signs |
| May | “carton 5-ply ” and “ CARTON 5-PLY” | Trim spaces and ignore capitals |
| Every file | A “Total” row at the bottom | Drop 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.
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
- 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.)
- Ask it to stop and say so when a column or a date cannot be read, instead of guessing.
- Ask for a check line at the end: the number of rows and the grand total.
- Run it on a copy and check the total against a figure you know before you use a single number.
- Read the lines it prints. “Using Amount column: Product name” was on the screen, and was the whole story.