Aquila.ExcelReader
1.0.3
dotnet add package Aquila.ExcelReader --version 1.0.3
NuGet\Install-Package Aquila.ExcelReader -Version 1.0.3
<PackageReference Include="Aquila.ExcelReader" Version="1.0.3" />
<PackageVersion Include="Aquila.ExcelReader" Version="1.0.3" />
<PackageReference Include="Aquila.ExcelReader" />
paket add Aquila.ExcelReader --version 1.0.3
#r "nuget: Aquila.ExcelReader, 1.0.3"
#:package Aquila.ExcelReader@1.0.3
#addin nuget:?package=Aquila.ExcelReader&version=1.0.3
#tool nuget:?package=Aquila.ExcelReader&version=1.0.3
Aquila.ExcelReader โ README & User Documentation
๐ฆ Overview
Aquila.ExcelReader is a lightweight, fluent, and developer-friendly Excel parsing library for .NET / .NET MAUI applications. It allows you to map Excel columns directly to C# models using a simple fluent API โ without complex configuration.
Designed for:
- Mobile apps (MAUI)
- Desktop apps
- Web APIs
- Data import tools
- Enterprise systems
โจ Key Features
- Fluent column mapping
- Header-based parsing
- Custom value converters
- Row validation support
- Skip empty rows
- Lightweight & fast
- Async streaming read
- Works across platforms (Windows / Android / etc.)
๐งฉ Installation
Add Package
Install via NuGet (or local reference):
dotnet add package Aquila.ExcelReader
Or add project reference if using source.
๐ Excel File Requirements
Your Excel sheet must:
- Contain a header row
- Header names must match mapped names
- Data must begin below header row
Example Excel
| itemname | price |
|---|---|
| aidly | 23 |
| adosa | 34 |
| abutter | 45 |
๐ Step-by-Step Usage
1๏ธโฃ Create a Model
Define the class representing a row:
public class Item
{
public string ItemName { get; set; }
public decimal Price { get; set; }
}
2๏ธโฃ Configure Mapping
Create column mapping between Excel headers and model properties.
var map = new AqlExcelMap<Item>()
.Map(x => x.ItemName)
.FromHeader("itemname")
.Build()
.Map(x => x.Price)
.FromHeader("price")
.WithConverter(v => decimal.Parse(v!))
.Build();
Mapping Options
| Method | Description |
|---|---|
FromHeader() |
Column header name |
Optional() |
Makes column optional |
WithConverter() |
Custom parsing logic |
Build() |
Finalizes column mapping |
3๏ธโฃ Read Excel File
var options = new AqlExcelOptions
{
HeaderRowNumber = 1,
SkipEmptyRows = true
};
var reader = new AqlExcelReader<Item>(map, options);
using var stream = File.OpenRead("items.xlsx");
var result = await reader.ReadAsync(stream);
4๏ธโฃ Access Results
foreach (var item in result.Records)
{
Console.WriteLine(item.ItemName);
Console.WriteLine(item.Price);
}
๐ก Validation Example
RowValidator = obj =>
{
var item = (Item)obj;
return item.Price < 0
? "Price cannot be negative"
: null;
}
๐ Result Object
AqlExcelResult<T> provides:
| Property | Description |
|---|---|
| Records | Parsed objects |
| Errors | Row errors |
| HasErrors | True if errors occurred |
Example:
if(result.HasErrors)
{
Console.WriteLine(result.Errors.Count);
}
๐งช Full Demo Service Example
public sealed class ExcelService
{
private readonly AqlExcelMap<Item> _map;
public ExcelService()
{
_map = new AqlExcelMap<Item>()
.Map(x => x.ItemName)
.FromHeader("itemname")
.Build()
.Map(x => x.Price)
.FromHeader("price")
.WithConverter(v => decimal.Parse(v!))
.Build();
}
public async Task<AqlExcelResult<Item>> ReadExcelAsync(Stream stream)
{
var options = new AqlExcelOptions
{
HeaderRowNumber = 1,
SkipEmptyRows = true
};
var reader = new AqlExcelReader<Item>(_map, options);
return await reader.ReadAsync(stream);
}
}
โ ๏ธ Common Mistakes
| Problem | Cause |
|---|---|
| 0 records returned | Missing .Build() |
| Empty data | Header mismatch |
| Conversion crash | Bad converter logic |
| Missing rows | Wrong HeaderRowNumber |
โ Best Practices
- Keep headers lowercase & simple
- Trim Excel header spaces
- Always call
.Build() - Validate numeric fields
- Use converters for culture-specific parsing
- Test mapping with small Excel files first
๐ Performance Tips
- Avoid heavy converters
- Skip validation if not needed
- Use async streams
- Map only required columns
๐ Platform Support
- .NET 8 / 9
- .NET MAUI
- Windows
- Android
- iOS (supported by design)
- macOS
๐ฎ Roadmap (Planned)
- Multi-sheet reading
- Column index mapping
- Header fuzzy matching
- Bulk import optimization
- Streaming low-memory mode
- Excel export companion
๐จโ๐ป Support
For issues or contributions:
- Submit GitHub issue
- Contact Aquila Innovations
- Review examples in DemoExcel_App
โค๏ธ Conclusion
Aquila.ExcelReader provides a clean, modern way to import Excel data into .NET applications with minimal setup while remaining highly extensible.
Itโs designed to scale from small mobile apps to enterprise-grade data pipelines.
Happy building ๐
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0-android35.0 is compatible. net9.0-maccatalyst18.0 is compatible. net9.0-windows10.0.19041 is compatible. net10.0-android was computed. net10.0-maccatalyst was computed. net10.0-windows was computed. |
-
net9.0-android35.0
- ClosedXML (>= 0.105.0)
- Microsoft.Maui.Controls (>= 9.0.111)
-
net9.0-maccatalyst18.0
- ClosedXML (>= 0.105.0)
- Microsoft.Maui.Controls (>= 9.0.111)
-
net9.0-windows10.0.19041
- ClosedXML (>= 0.105.0)
- Microsoft.Maui.Controls (>= 9.0.111)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.