YGMSExcelBeater 1.0.6
dotnet add package YGMSExcelBeater --version 1.0.6
NuGet\Install-Package YGMSExcelBeater -Version 1.0.6
<PackageReference Include="YGMSExcelBeater" Version="1.0.6" />
paket add YGMSExcelBeater --version 1.0.6
#r "nuget: YGMSExcelBeater, 1.0.6"
// Install YGMSExcelBeater as a Cake Addin #addin nuget:?package=YGMSExcelBeater&version=1.0.6 // Install YGMSExcelBeater as a Cake Tool #tool nuget:?package=YGMSExcelBeater&version=1.0.6
README
What is this repository for?
This class libary uses NPOI to read and write to excel file with c# .net 6 and above. It has internal mapper to map the contents of Excel sheet to a generic collection List<T> as long as the property names match the field names in the excel file. The header row must be the first row and data must start from the first column, second row
How do I get set up?
The Excel file must have a header to hold the field names. The field names must not have spaces or special characters All field names must be reproducable in the DTO where the records are mapped to
Sample setup: (Excel containing a key field in column 0 "L-2" being one of the unique values )
// Sample.xlsx is provided in the source code - just an excel file containing RecordID, Name, Title, IsActive, and DOB
string excelFileName = "C:\\Temp\\Sample.xlsx";
// Constructor takes filename, sheet number, and column number for the key, or, column name
using (IMSExcelBeater beater = new MSExcelBeater(excelFileName, 0, 0)) // first parm: filename, second parm: sheet number. Third parm: key column number or name
{
string title = beater.Get("L-2", "title"); // This is to get a value from column "title" row key number "L-2"
string result1 = beater.Update("L-2", "title", "bloon"); // This is to update the value in column "title" row key number "L-2"
string result2 = beater.Save(); // This is to save all the updates. Remember to invoke .Save() to save your changes.
List<TestDTO> allData = beater.GetAllData<TestDTO>(); // This is to retrieve the entire sheet into a generic collection
string[] fieldNames = beater.GetAllFieldNames(); // This is to retreve all field names in the excel file
}
Contribution guidelines
- Writing tests
- Code review
- Other guidelines
Who do I talk to?
- Repo owner or admin
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
- NPOI (>= 2.7.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Handle null in the key field