FlatExcelHelper 1.0.4
dotnet add package FlatExcelHelper --version 1.0.4
NuGet\Install-Package FlatExcelHelper -Version 1.0.4
<PackageReference Include="FlatExcelHelper" Version="1.0.4" />
paket add FlatExcelHelper --version 1.0.4
#r "nuget: FlatExcelHelper, 1.0.4"
// Install FlatExcelHelper as a Cake Addin #addin nuget:?package=FlatExcelHelper&version=1.0.4 // Install FlatExcelHelper as a Cake Tool #tool nuget:?package=FlatExcelHelper&version=1.0.4
Flat and Excel file helper to datatable
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net451 is compatible. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- ClosedXML (>= 0.87.1)
- DocumentFormat.OpenXml (>= 2.7.1)
- FlatFiles (>= 0.3.20)
- System.Data.Common (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.4 | 1,209 | 5/22/2017 |
Sample code:
static void Main(string[] args)
{
try
{
DataTable table = null;
string flatExcelFile = @"d:\CsvHelperClass\sample\sample.xlsx";
string config = File.ReadAllText(@"d:\CsvHelperClass\sample\mapper_otp_xls.xml");
var flatExcelHelper = new FlatExcelHelper();
var fileExt = Path.GetExtension(flatExcelFile).ToLower();
string[] flatExts = { ".csv", ".txt" };
string[] excelExts = { ".xls", ".xlsx" };
if (flatExts.Contains(fileExt))
table = flatExcelHelper.ReadFlat(flatExcelFile, ref config);
else if (excelExts.Contains(fileExt))
table = flatExcelHelper.ReadExcel(flatExcelFile, ref config);
foreach (DataRow dr in table.Rows)
{
Console.WriteLine(string.Format("{0} - {1} - {2} - {3}", dr.ItemArray));
}
if (flatExts.Contains(fileExt))
{
string result = flatExcelHelper.WriteFlat(ref table, ref config);
Console.WriteLine(result);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
Console.ReadKey();
}
}