KhatiExcel

Published At 2025/Aug/05
No Image Found

KhatiExcel is a lightweight, high-performance C# library designed to simplify Excel file processing in .NET applications. Built for developers who need to read, parse, and work with Excel data effortlessly, KhatiExcel provides a clean API to convert Excel files into strongly-typed C# object lists using minimal configuration.

🔑 Features:

  • 📄 Excel to Object Mapping — Automatically maps Excel rows to C# classes.

  • Asynchronous Support — Perform fast and responsive reads with async/await.

  • Header Matching — Matches column headers to property names or custom attributes.

  • 🧠 Type Conversion — Handles automatic type parsing from Excel cells to .NET types.

  • No External Dependencies — Lightweight and self-contained.

  • 💼 Ideal for Business Apps — Perfect for admin dashboards, data import tools, or internal apps.

Add Middleware

  1. builder.Services.ExcelFeature();

Excel Feature

  1. using KhatiExcel.Feature;
  2. using KhatiExcelImplementation.Model;
  3. using Microsoft.AspNetCore.Mvc;
  4. namespace KhatiExcelImplementation.Controllers
  5. {
  6. [ApiController]
  7. [Route("api/[controller]/[action]")]
  8. public class ExcelFeatureController : Controller
  9. {
  10. private readonly ILoadExcel _loadExcel;
  11. public ExcelFeatureController(ILoadExcel loadExcel)
  12. {
  13. _loadExcel = loadExcel;
  14. }
  15. [HttpPost]
  16. public IActionResult ReadExcel(IFormFile file)
  17. {
  18. var result = _loadExcel.Fetch(file,"Sheet1");
  19. return Ok(result.data);
  20. }
  21. [HttpGet]
  22. public IActionResult ReadExcelPath()
  23. {
  24. var result = _loadExcel.Fetch("C:/Users/BS01389/Downloads/BiologyBooks.xlsx", "Sheet1");
  25. return Ok(result.data);
  26. }
  27. [HttpPost]
  28. public IActionResult SubmitBook([FromBody] List<Book> model)
  29. {
  30. var result = _loadExcel.ListToExcelBase64("BookInfo",new List<string>() { "Id","Title","Price" }, model);
  31. return Ok(result.base64);
  32. }
  33. }
  34. }

Package Source

Package Source Link

Package Implementation Link

Package Implementation Link