BrowardHealth.EPPlusHelperCore 1.7.3

dotnet add package BrowardHealth.EPPlusHelperCore --version 1.7.3
NuGet\Install-Package BrowardHealth.EPPlusHelperCore -Version 1.7.3
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="BrowardHealth.EPPlusHelperCore" Version="1.7.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BrowardHealth.EPPlusHelperCore --version 1.7.3
#r "nuget: BrowardHealth.EPPlusHelperCore, 1.7.3"
#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 BrowardHealth.EPPlusHelperCore as a Cake Addin
#addin nuget:?package=BrowardHealth.EPPlusHelperCore&version=1.7.3

// Install BrowardHealth.EPPlusHelperCore as a Cake Tool
#tool nuget:?package=BrowardHealth.EPPlusHelperCore&version=1.7.3
    static async Task Main(string[] args)
    {
        string execDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        string inputFileName = "Test.xlsx";
        string inputFilePath = Path.Combine(execDir, inputFileName);

        Console.WriteLine($"{inputFilePath} => DataTable...");
        DataTable dataTable = inputFilePath.EPPlusReadFromExcel();

        Console.WriteLine($"{inputFilePath} => Json...");
        string json = inputFilePath.EPPlusReadJsonFromExcel();
        File.WriteAllText(Path.Combine(execDir, Path.GetFileNameWithoutExtension(inputFileName)+".json"), 
            json);
        //Console.WriteLine($"{json}");

        string outputFileName = "TestOut.xlsx";

        string outputFilePath = Path.Combine(execDir, outputFileName);
        Console.WriteLine($"DataTable => {outputFilePath}...");
        dataTable.EPPlusWriteExcelFile(outputFilePath, 
            tableStyles: OfficeOpenXml.Table.TableStyles.Medium20);


        Console.WriteLine($"{outputFilePath} => html...");
        var html = outputFilePath.EPPlusReadHtmlFromExcel();
        File.WriteAllText(Path.Combine(execDir, Path.GetFileNameWithoutExtension(outputFileName) + ".html"), 
            html.html);
        //Console.WriteLine($"{html.html}");
        File.WriteAllText(Path.Combine(execDir, Path.GetFileNameWithoutExtension(outputFileName) + ".css"), 
            html.css);
        //Console.WriteLine($"{html.css}");
        var htmlTemplate = "<html>\r\n<head>\r\n<style type=\"text/css\">\r\n{0}</style></head>\r\n<body>\r\n{1}</body>\r\n</html>";
        File.WriteAllText(Path.Combine(execDir, Path.GetFileNameWithoutExtension(outputFileName) + "Combined.html"),
            string.Format(htmlTemplate, html.css, html.html));


        Console.WriteLine($"{inputFilePath} => dynamic list...");
        List<dynamic> list = inputFilePath.EPPlusReadFromExcel<dynamic>();

        string outputFileName1 = "TestOut1.xlsx";

        string outputFilePath1 = Path.Combine(execDir, outputFileName1);
        Console.WriteLine($"List => {outputFilePath1}...");
        list.EPPlusWriteExcelFile(outputFilePath1);


        string inputFileName2 = "Test.csv";
        string outputFileName2 = "TestOut2.xlsx";

        string inputFilePath2 = Path.Combine(execDir, inputFileName2);
        string outputFilePath2 = Path.Combine(execDir, outputFileName2);
        Console.WriteLine($"{inputFilePath2} => {outputFilePath2}...");
        await inputFilePath2.EPPlusWriteExcelFileAsync(outputFilePath2
            //, excelTextFormat: null
            , excelTextFormat: new()
            {
                Delimiter = ',',
                SkipLinesEnd = 1,
                TextQualifier = '\"',
                DataTypes = new eDataTypes[] { 
                    eDataTypes.DateTime, 
                    eDataTypes.Number, 
                    eDataTypes.String  }
            }
            );

        string outputFileName3 = "TestOut3.csv";
        string outputFilePath3 = Path.Combine(execDir, outputFileName3);
        Console.WriteLine($"{outputFilePath} => {outputFilePath3}...");
        await outputFilePath.EPPlusWriteCsvFileAsync(outputFilePath3
            //, excelOutputTextFormat: null
            , excelOutputTextFormat: new()
            {
                Delimiter = ',',
                SkipLinesEnd = 1,
                TextQualifier = '\"',
                FirstRowIsHeader = true                    
            }
            );

        string outputFileName4 = "TestOut4.json";
        string outputFilePath4 = Path.Combine(execDir, outputFileName4);
        Console.WriteLine($"{outputFilePath} => {outputFilePath4}...");

        await outputFilePath.EPPlusWriteJsonFileAsync(outputFilePath4);

        // option 1
        Console.WriteLine($"{inputFilePath} => dynamic list...");
        List<dynamic> list1 = inputFilePath.EPPlusReadFromExcel<dynamic>();

        foreach (dynamic row in list1.Take(5))
        {
            Console.WriteLine($"{row.PT_Number}, {row.Admit_Date}");
        }

        // option 2
        Console.WriteLine($"{inputFilePath} => ExpandoObject list...");
        List<ExpandoObject> list2 = inputFilePath.EPPlusReadFromExcel<ExpandoObject>();

        foreach (ExpandoObject eo in list2.Take(5))
        {
            var dict = (IDictionary<string, object>)eo;
            foreach (string key in dict.Keys)
            {
                Console.Write($"{key}, {dict[key]}; ");
            }
            Console.WriteLine();
        }

        // option 3
        Console.WriteLine($"{inputFilePath} => Dictionary list...");
        List<Dictionary<string, object>> list3 = inputFilePath.EPPlusReadFromExcel<Dictionary<string, object>>();

        foreach (var dict in list3.Take(5))
        {
            foreach (KeyValuePair<string, object> pair in dict.ToList())
            {
                Console.Write($"{pair.Key}, {pair.Value}; ");
            }
            Console.WriteLine();
        }


        Console.WriteLine("Enter any key to exit...");

        Console.ReadKey();
    }
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
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.7.3 143 9/7/2023
1.7.2 121 8/18/2023
1.7.1 130 8/18/2023
1.7.0 129 8/18/2023
1.6.0 139 8/18/2023
1.5.0 141 8/18/2023
1.4.0 139 8/18/2023
1.3.0 139 8/17/2023
1.1.0 136 8/17/2023