Format a CSV Sales Report

Sales data is the lifeblood of e-commerce and retail analytics, and CSV is the universal export format for this data across virtually every platform — Shopify, WooCommerce, Stripe, SAP, QuickBooks, and dozens of others all export transaction data as CSV. Reviewing sales CSV files before analysis is essential because real-world exports frequently contain formatting inconsistencies, missing values, currency symbol contamination in numeric fields, and date format variations that break calculations. This example shows an order-level sales report with eight columns covering the essential dimensions for sales analysis: transaction date, order identifier, product name and SKU for catalog linkage, quantity sold, unit price, calculated revenue (quantity × unit price), and geographic region for regional breakdown. This structure supports the most common business questions: total revenue, revenue by product, revenue by region, units sold, and average order value. Data quality issues to watch for in sales CSVs: revenue values sometimes include currency symbols ("$159.98") that prevent spreadsheet formulas from treating them as numbers — always check that numeric columns contain only digits and decimal points. Unit prices may use different decimal separators (comma vs period) in European exports, which causes silent errors when the file is opened in a spreadsheet with different locale settings. The region field should be validated against your expected regions list since typos like "US-West" instead of "US-WEST" break grouping operations. Date handling is particularly important: when sorting a CSV by date, the format must be lexicographically sortable (ISO 8601 YYYY-MM-DD sorts correctly; MM/DD/YYYY does not). This example uses ISO format, but many ERP exports use locale-specific formats that require normalization before sorting or comparison. Revenue calculation validation: always verify that revenue = quantity × unit_price for at least a sample of rows. Discrepancies indicate discounts, returns, or promotions that weren't captured in other columns, which can significantly distort analysis if not accounted for. Real-world analytical workflows: loading this CSV into a pandas DataFrame, grouping by region and summing revenue, then building a bar chart comparing regional performance; importing into Google Sheets and using SUMIF to calculate product-level revenue summaries; feeding into a BI tool like Tableau or Looker as a data source for an executive dashboard. Tips: standardize on one date format, one decimal separator, and no currency symbols before storing or sharing sales data. Create a data dictionary documenting what each column means, its format, and its possible values to prevent misinterpretation.

Example
date,order_id,product,sku,quantity,unit_price,revenue,region
2024-01-05,ORD-001,Wireless Keyboard,KB-100,2,79.99,159.98,US-WEST
2024-01-07,ORD-002,USB-C Hub,HUB-200,1,49.99,49.99,US-EAST
2024-01-08,ORD-003,Monitor Stand,MS-300,3,34.99,104.97,EU
2024-01-10,ORD-004,Webcam 1080p,CAM-400,1,89.99,89.99,US-WEST
2024-01-12,ORD-005,Desk Lamp,LAMP-500,2,28.99,57.98,APAC
[ open in CSV File Viewer → ]

FAQ

How do I calculate totals from a CSV sales file?
Import the CSV into Excel or Google Sheets and use SUM with SUMIF for conditional totals. For code-based analysis, use pandas in Python or a SQL query after importing to a database.
What causes number formatting issues in CSV files?
Different locales use comma or period as the decimal separator, and thousand separators vary. Ensure your export uses consistent decimal notation, and avoid including currency symbols in numeric columns.
How do I filter CSV data without a spreadsheet?
Use the CSV file viewer which supports column sorting and search filtering. For programmatic filtering, tools like the CSV to SQL converter let you write SELECT queries against the data.

Related Examples