Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

C#intermediatewebAI generated

CSV Import Dashboard

Build a web dashboard in C# with ASP.NET Core for importing CSV files into a PostgreSQL database: upload a file, map its columns to fields, and the app checks every row against validation rules, imports the good rows, and shows a clear report of the problems (which row, which field and why) that can be downloaded to fix and re-upload. A summary shows totals and simple statistics about the imported data, and past imports can be reviewed. Large files are streamed so they don't fill memory, and importing the same file twice doesn't create duplicates. You'll learn file uploads in ASP.NET Core, parsing CSV with CsvHelper, validation, bulk inserts into PostgreSQL, JSON with System.Text.Json, and building a useful admin interface.

Estimate
~12h
Steps
6
Completed by
0
Proposed by
codeseed.app

ASP.NET Core · CsvHelper · Npgsql · PostgreSQL

Project roadmap

  1. 01

    Define the import

    ~1.5h

    Write DESIGN.md: the target data (for example customers or products, with each field's type and rules), the import steps (upload, preview and map columns, validate, import, and report), what counts as a duplicate (a natural key such as email or SKU), the import history (file name, time, row counts and errors stored as JSON with System.Text.Json), and the size limits. Create an ASP.NET Core project with Razor Pages (or Blazor), CsvHelper and Npgsql. Done when: DESIGN.md covers the data, steps, rules and limits.

  2. 02

    Upload and preview

    ~2h

    Build an upload page with a size limit, store the file under a random name, and show a preview of the first 10 rows with the detected columns. Let the user map each file column to a field (suggesting matches by name) and check that required fields are mapped. Handle files that aren't valid CSV clearly. Done when: a CSV can be uploaded, previewed and mapped.

  3. 03

    Validate rows

    ~2h

    Stream the file with CsvHelper, map each row using the chosen columns, and validate every field (required, type, length, email format and allowed values), collecting errors with the row number, field and message. Stop reading when errors pass a limit (for example the wrong file was uploaded). Done when: every problem in a messy sample file is reported with its row and field.

  4. 04

    Import into PostgreSQL

    ~2.5h

    Import valid rows in batches using Npgsql's binary COPY into a staging table, then insert into the target table with INSERT ... ON CONFLICT on the natural key (updating or skipping, as chosen), all in one transaction so a failure leaves nothing half-imported. Record the import with its counts. Done when: a large file imports quickly, and importing it again creates no duplicates.

  5. 05

    Show the report and summary

    ~2h

    Show a report page with counts (read, imported, updated and rejected), the errors grouped by field and message with examples, and a download of rejected rows as CSV with an extra errors column. Add simple statistics about the imported data (such as counts per category) and a history page of past imports. Done when: the report explains every rejected row, and the download can be fixed and re-uploaded.

  6. 06

    Test it

    ~2h

    Write xUnit tests: validation rules, column mapping, streaming a large generated file with low memory, duplicate handling on re-import, rollback on a failure midway, and page tests with WebApplicationFactory and PostgreSQL in Testcontainers. Done when: dotnet test passes.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~12h · 6 steps

Tech stack

ASP.NET CoreCsvHelperNpgsqlPostgreSQL