ConfigSupport 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConfigSupport --version 1.0.2                
NuGet\Install-Package ConfigSupport -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConfigSupport" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConfigSupport --version 1.0.2                
#r "nuget: ConfigSupport, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ConfigSupport as a Cake Addin
#addin nuget:?package=ConfigSupport&version=1.0.2

// Install ConfigSupport as a Cake Tool
#tool nuget:?package=ConfigSupport&version=1.0.2                

Excel Data Importer

The Excel Data Importer is a simple library for importing data from Excel files (.xlsx) into a .NET application. It provides a class ProcessExcel, which contains a method ImportExcelData for importing Excel data and ExcelToJSONConvertMethod for converting Excel data into formatted JSON string.

Installation

To use the Excel Data Importer in your .NET project, follow these steps:

Ensure you have all this library installed in your project. You can install it via NuGet using the following command:

  • Install-Package EPPlus
  • Install-Package Newtonsoft.Json
  • Install-Package ConfigSupport

Usage

using ConfigSupport;

Excel file to Data:

The ProcessExcel class provides a method ImportExcelData for importing Excel data. Here's how you can use it:

Parameters:

  • fileName: Specify the name of your Excel file.
  • folderPath: Specify the folder path where your Excel file is located.

Example:

class Program
{
    static void Main(string[] args)
    {
        ProcessExcel excelProcessor = new ProcessExcel();
        string fileName = "example.xlsx"; // Specify the name of your Excel file
        string folderPath = "path/to/your/excel/files"; // Specify the folder path where your Excel file is located
        var importResponse = excelProcessor.ImportExcelData(fileName, folderPath);
        // Use the importResponse as needed in your application
    }
}

Return Value:

Return as instance of the ImportClassDataResponse class, containing the following properties:

  • ResponseString: A string representing the response message. It is empty if there are no errors or issues during the import process.
  • OPCSheetDictionaryData: A dictionary containing the imported data extracted from the Excel file. Each key represents a sheet name, and its corresponding value is a list of string arrays representing the rows of data in that sheet. Example Response:
ImportClassDataResponse importResponse = new ImportClassDataResponse
{
    ResponseString = "Data imported successfully.",
    OPCSheetDictionaryData = new Dictionary<string, List<string[]>>
    {
        {
            "Sheet1", new List<string[]>
            {
                new string[] { "Header1", "Header2", "Header3" },
                new string[] { "Data1", "Data2", "Data3" },
                new string[] { "Data4", "Data5", "Data6" }
            }
        },
        {
            "Sheet2", new List<string[]>
            {
                new string[] { "Header1", "Header2", "Header3" },
                new string[] { "Data1", "Data2", "Data3" },
                new string[] { "Data4", "Data5", "Data6" }
            }
        }
    }
};

Excel data to Json:

The ProcessExcel class provides a method ExcelToJSONConvertMethod Converts Excel data to JSON format string.

Parameters:

  • opcSheetDictionaryData: Data which is extracted from the Excel.
  • subProcess: An array of strings with all sub-processes.
  • dataType: An array of strings with all data types.
  • descriptionPattern: Regex pattern to check the description pattern.

Example:

class Program
{
    static void Main(string[] args)
    {
        // Create an instance of your class
        ProcessExcel yourClassInstance = new ProcessExcel();

        // Prepare sample data
        Dictionary<string, List<string[]>> opcSheetDictionaryData = new Dictionary<string, List<string[]>>();
        // Add sample data to opcSheetDictionaryData

        string[] subProcess = new string[] { "SubProcess1", "SubProcess2", "SubProcess3" };
        string[] dataType = new string[] { "DataType1", "DataType2", "DataType3" };
        string descriptionPattern = "YourRegexPattern";

        // Call the ExcelToJSONConvertMethod
        string jsonResult = yourClassInstance.ExcelToJSONConvertMethod(opcSheetDictionaryData, subProcess, dataType, descriptionPattern);

        // Use the jsonResult as needed in your application
    }
}

Return Value:

The return is a JSON formatted string. Example Response:

{
  "name": "string",
  "version": "string",
  "comment": "string",
  "instanceNamespaceUri": "string",
  "opcGatewayOptions": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "opcNodeConfig": [
    {
      "description": "string",
      "version": "string",
      "nameSpaceUri": "string",
      "opcNodes": [
        {
          "name": "string",
          "type": "string",
          "addedToTree": true,
          "description": "string",
          "template": "string",
          "childTypes": [
            "string"
          ]
        }
      ],
      "xmlConfig": "string"
    }
  ]
}

Contributing

Contributions to the Excel Data Importer library are welcome!

License

This project is licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.8 80 6/15/2024
1.0.6 70 6/11/2024
1.0.5 66 6/11/2024
1.0.4 61 6/7/2024
1.0.3 67 6/7/2024
1.0.2 71 6/7/2024
1.0.1 61 6/7/2024
1.0.0 63 6/7/2024