ExcelShaper is a .NET library designed to facilitate reading and shaping Excel files. It provides convenient methods for extracting data from Excel files based on sheet index or header names and offers custom conversion capabilities to convert Excel data into custom types.
ExcelShaper is available as a NuGet package. You can install it via NuGet Package Manager or .NET CLI.
dotnet add package ExcelShaper
string filePath = "path/to/your/excel/file.xlsx";
var data = Engine.ReadExcelFileByIndex(filePath);
string filePath = "path/to/your/excel/file.xlsx";
var data = Engine.ReadExcelFileByHeader(filePath);
public class Person
{
public int Index { get; set; }
public string FirstName { get; set; } = "";
//more properties
}
string filePath = "path/to/your/excel/file.xlsx";
var data = Engine.ReadExcelFileByHeader(filePath, (rowData) =>
{
return new Person
{
Age = int.Parse(rowData["age"]),
Country = rowData["country"],
//more properties
};
});
string filePath = "path/to/your/excel/file.xlsx";
var data = Engine.ReadExcelFileByHeader(filePath, (rowData) =>
{
// Define your conversion logic here
},sheetIndex : 1,dateFormat : "dd/MM/yyyy");
Contributions are welcome! If you encounter any bugs or have suggestions for improvements, feel free to open an issue or submit a pull request.
To contribute to ExcelShaper, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/improvement
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/improvement
). - Create a new Pull Request.
Please make sure to follow the code style and conventions used in the project and ensure that your changes pass all tests.
This project is licensed under the MIT License.