Hi all!
I got Claude Code to fix my downloaded Amazon csv such that it could be imported.
What Amazon changed
- 4 column names renamed:
- Quantity → Original Quantity
- Total Owed → Total Amount
- Payment Instrument Type → Payment Method Type
- Gift Recipient Contact Details → Gift Recipient Contact
- Columns reordered from a specific order to alphabetical
- CSV quoting removed — values used to all be wrapped in quotes, now they’re not
- No longer sorted by date descending
- New column added — Item Serial Number (didn’t exist before)
Save this as fix_amazon_csv.py in the same folder as your Amazon data export, then run python3 fix_amazon_csv.py. It writes a new file and leaves the original
untouched.
You can try this out and hopefully it works for y’all (at your own risk):
#!/usr/bin/env python3
"""Fix Amazon Order History CSV to match the old format expected by Tiller."""
import csv
import sys
from pathlib import Path
INPUT = Path("Your Amazon Orders/Order History.csv")
OUTPUT = Path("Your Amazon Orders/Order History (fixed).csv")
# Column renames: new name -> old name
RENAMES = {
"Total Amount": "Total Owed",
"Original Quantity": "Quantity",
"Payment Method Type": "Payment Instrument Type",
"Gift Recipient Contact": "Gift Recipient Contact Details",
}
# Old column order (what Tiller expects)
OLD_ORDER = [
"Website",
"Order ID",
"Order Date",
"Purchase Order Number",
"Currency",
"Unit Price",
"Unit Price Tax",
"Shipping Charge",
"Total Discounts",
"Total Owed",
"Shipment Item Subtotal",
"Shipment Item Subtotal Tax",
"ASIN",
"Product Condition",
"Quantity",
"Payment Instrument Type",
"Order Status",
"Shipment Status",
"Ship Date",
"Shipping Option",
"Shipping Address",
"Billing Address",
"Carrier Name & Tracking Number",
"Product Name",
"Gift Message",
"Gift Sender Name",
"Gift Recipient Contact Details",
]
with open(INPUT, newline="", encoding="utf-8") as f:
reader = csv.DictReader(f)
rows = list(reader)
# Apply renames
for row in rows:
for new_name, old_name in RENAMES.items():
if new_name in row:
row[old_name] = row.pop(new_name)
# Sort by Order Date descending
rows.sort(key=lambda r: r.get("Order Date", ""), reverse=True)
# Write with old column order, all values quoted
with open(OUTPUT, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(
f,
fieldnames=OLD_ORDER,
quoting=csv.QUOTE_ALL,
extrasaction="ignore",
)
writer.writeheader()
writer.writerows(rows)
print(f"Wrote {len(rows)} rows to {OUTPUT}")
The fixed file will be at Your Amazon Orders/Order History (fixed).csv — import that instead of the original.