Project Hub

Project · Branch Excel report

192 branch Excel files merged into one weekly report with one command

The problem

Every branch sends its own Excel file in its own format, so someone spends hours each week copying, fixing and pasting before anyone sees a total.

The solution

One script reads every branch file, cleans names, dates and amounts to one standard, sets aside rows that break the rules with the reason, and rebuilds the weekly report in Excel and Power BI with one command.

How it works

  • Collect: Every branch's monthly Excel file dropped in one folder
  • Clean: Names, dates, products and amounts fixed to one standard, duplicates removed
  • Check: Rows that break the rules set aside with the reason, never silently dropped
  • Merge: One clean, trusted table across all branches and months
  • Report: A weekly Excel and Power BI report rebuilt with one command

A closer look

Pipeline diagram: the Bronze, Silver and Gold layers read, clean and check the branch Excel files into a clean sales file, a file log and a file of set-aside rows, then the Semantic, Analytical and Reporting layers rebuild the weekly Excel report and Power BI.
What the one-click run does, step by step.
Mental model: 192 branch files from West, East, Central and South, each laid out its own way, are cleaned and checked into one table of 9,836 rows, and 253 rows are set aside with the reason: 96 pasted twice, 37 amounts not a number, 31 bad dates, 30 in the wrong month, 30 quantities of zero or less and 29 with no ID.
Many messy files in, one clean table out.
Data flow: one box per step, in run order, from the input files to the report.
The steps, in run order.
 is the Power BI model: 9,836 sales rows joined to 4 branches and 1,461 dates, with the 253 set-aside rows and the log of 192 files beside the star, so one branch slicer filters all three.
The star schema: sales and data-quality tables share one branch slicer.
Chart: the 253 set-aside rows by mistake and branch; West has 84, East 74, Central 55 and South 40, and duplicates are the biggest mistake in West and East with 32 each.
Where each kind of mistake comes from.
Chart: weekly sales for all branches from January 2016 to December 2019, built from the one clean table, with a four-week average that climbs each autumn.
Weekly sales, from the one clean table.

The code

order_date: [Order Date, Date]
ship_mode: [Ship Mode, Shipping]
segment: [Segment, Customer Type]
city: [City]
state: [State]
product_id: [Product ID, SKU]
category: [Category]
sub_category: [Sub-Category, Subcategory]
product_name: [Product Name, Item]
quantity: [Quantity, Qty]
sales: [Sales, Amount]
profit: [Profit]
config/client.yaml

The impact

  • The weekly copy, paste and VLOOKUP routine replaced by one command.
  • Every branch in the same format, so totals match.
  • Bad rows listed with the reason, so they get fixed at the source.

The result

10,089 rows across 192 branch files: all 253 errors caught and set aside with their row and reason.

Built with

  • Python
  • pandas
  • Excel
  • Power Query
  • Power BI