Holbor.Converter.Excel
1.0.0
See the version list below for details.
dotnet add package Holbor.Converter.Excel --version 1.0.0
NuGet\Install-Package Holbor.Converter.Excel -Version 1.0.0
<PackageReference Include="Holbor.Converter.Excel" Version="1.0.0" />
paket add Holbor.Converter.Excel --version 1.0.0
#r "nuget: Holbor.Converter.Excel, 1.0.0"
// Install Holbor.Converter.Excel as a Cake Addin #addin nuget:?package=Holbor.Converter.Excel&version=1.0.0 // Install Holbor.Converter.Excel as a Cake Tool #tool nuget:?package=Holbor.Converter.Excel&version=1.0.0
ExcelConverter
This package allows you to convert Microsoft Excel files to a Dictionary type. So, with that, you may have a JSON code.
Installation
The main package that have the code is .NET Standard 2.0. So, it is compatible with many versions of .NET Framework and .NET Core.
Usage
Use the method Converter.ExcelConverter.Services.ConvertExcelToDictionary()
. It receives a Stream
that must contains the Microsoft Excel file (XLSX).
using (var stream = System.IO.File.Open("C:/file.xlsx", FileMode.Open, FileAccess.Read))
{
var dictionary = service.ConvertExcelToDictionary(stream);
// Dictionary<string, ICollection<Dictionary<string, object>>>
}
If you would like to use it directly into a DataTableCollection
object, use the extension method Converter.ExcelConverter.Extensions.AsDictionary()
. In this case, once you are using the extension method, you just have to call it as a DataTableCollection
method.
var result = dataSet.Tables.AsDictionary();
// Dictionary<string, ICollection<Dictionary<string, object>>>
Calling from Web API
By default, there is a basic Web API project you can use to send the Microsoft Excel file and receive the JSON code in response's body.
To do this, make a call as the following.
GET /api/converter HTTP/1.1
Host: localhost:5001
Content-Type: multipart/form-data;
Content-Disposition: form-data; name="file"; filename="C:\file_excel.xlsx"
Pay attention to the Content-Disposition
name. The default request method uses the file
parameter; so, you should put your Microsoft Excel file into it.
Calling from Console application
By default, there is a basic console application you can use to sendn the Microsoft Excel file and write the JSON result in a file in the sabe directory of Excel's file.
To do this, execute the console application (EXE) passing the Microsoft Excel file's full path as parameter.
Converter.Presentation.Console.exe "C:\file_excel.xlsx"
After processing, it will create an .json
file in the same directory of .xlsx
file. The .json
file will have the same name of .xlsx
file.
Compatibility
In the version 1.0, this package only supports XLSX files.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ExcelDataReader (>= 3.4.2)
- ExcelDataReader.DataSet (>= 3.4.2)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Text.Encoding.CodePages (>= 4.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.