Expense Tracker CLI with CSV Import/Export
Build a console app in C# for tracking personal spending. You add expenses (amount, category, date and an optional note), list them, and see totals per category and per month, for example how much went on food in March. Everything is saved to a CSV file with the CsvHelper library, so the data can also be opened in Excel, and you can import expenses from a bank's CSV export or export a filtered list. It's a practical first C# project: you'll learn records and lists, a menu loop, reading user input safely, reading and writing CSV files, and using LINQ to group and total data.
- Estimate
- ~8h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
.NET CLI · LINQ · CsvHelper
Project roadmap
- 01
Create the project and Expense model
~1hCreate a console project with dotnet new console and add CsvHelper with dotnet add package CsvHelper. Define an Expense record with Id, Amount (decimal, never double, for money), Category, Date (DateOnly) and Note. Done when: the project builds and runs.
- 02
Build the menu
~1.5hWrite a menu loop offering: add an expense, list expenses, show the summary, import CSV, export CSV and quit. Listing shows expenses newest first in aligned columns, with amounts formatted to 2 decimals. Keep expenses in a List<Expense> for now. Done when: expenses can be added and listed from the menu.
- 03
Validate input
~1hWhen adding, parse the amount with decimal.TryParse (it must be greater than 0), and the date with DateOnly.TryParse (empty means today, and future dates are refused). The category can't be empty; offer the existing categories as suggestions. Ask again with a clear message on invalid input instead of crashing. Done when: typing letters for the amount or an invalid date re-asks the question.
- 04
Save to CSV
~1.5hSave all expenses to expenses.csv with CsvHelper after every change, using CultureInfo.InvariantCulture so decimals are always written with a dot. Load the file at startup, and start with an empty list when it doesn't exist. If the file is damaged, show which line is wrong instead of crashing. Done when: expenses are still there after restarting the app.
- 05
Show summaries with LINQ
~1.5hUse LINQ GroupBy to show the total per category (largest first, with each category's share of the total as a percentage) and the total per month (for example 2026-03), optionally filtered by a date range. Show the grand total at the end. Done when: the summary totals match the listed expenses.
- 06
Import and export
~1.5hImport expenses from another CSV file, mapping its columns with a CsvHelper ClassMap, skipping duplicates (same date, amount and note) and reporting how many were added and skipped. Export expenses for a chosen category or date range to a new CSV. Done when: importing the same file twice adds nothing the second time.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack