| Crates.io | sales |
| lib.rs | sales |
| version | 0.2.0 |
| created_at | 2025-07-16 13:35:18.214597+00 |
| updated_at | 2025-08-08 11:25:35.139705+00 |
| description | A command-line tool, and library, for reporting and aggregating sales data (for example, from CSV files). |
| homepage | https://github.com/bitfield/sales |
| repository | https://github.com/bitfield/sales |
| max_upload_size | |
| id | 1755516 |
| size | 59,630 |
The sales crate provides a command-line tool, and library, for reporting and aggregating sales data (for example, from CSV files).
cargo install sales
Download your sales data for the relevant period to a file, for example, data.csv, and run:
sales data.csv
Example output:
Product / Group Units Revenue
------------------------------------------------------------------------
Go mentoring 11 3134.45
Code For Your Life 2 79.90
For the Love of Go (2023) 1 39.95
For the Love of Go: Video/Book Bundle (2023 edition) 1 74.95
The Power of Go: Tests 1 39.95
The Power of Go: Tools 1 39.95
------------------------------------------------------------------------
Total 17 3409.15
The default sorting is by unit sales, descending, and then alphabetically. To sort by revenue instead, use the --revenue flag:
sales --revenue data.csv
Product / Group Units Revenue
------------------------------------------------------------------------
Go mentoring 11 3134.45
Code For Your Life 2 79.90
For the Love of Go: Video/Book Bundle (2023 edition) 1 74.95
For the Love of Go (2023) 1 39.95
The Power of Go: Tests 1 39.95
The Power of Go: Tools 1 39.95
------------------------------------------------------------------------
Total 17 3409.15
To aggregate the sales data for a group of related products, create a group specification file with the following format:
GROUP_NAME | GROUP_REGEX
A simple example, which groups two sets of products by matching shared substrings in their names:
For the Love of Go | For the Love
Power of Go Series | The Power of Go
Use the --groups flag to apply this group specification, and rerun the tool to see the result:
sales --groups groups.txt data.csv
Product / Group Units Revenue
--------------------------------------
Go mentoring 11 3134.45
Code For Your Life 2 79.90
For the Love of Go 2 114.90
Power of Go Series 2 79.90
--------------------------------------
Total 17 3409.15
sales can interpret CSV data produced by Squarespace, Gumroad, and similar platforms. It reads only the product name, price, and quantity columns.
The product name column heading should be "Lineitem name" or "Item Name".
The product price column heading should be "Lineitem price" or "Item Price ($)".
The product quantity column heading should be "Lineitem quantity" or "Quantity".