DataJuggler.Excelerate 6.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DataJuggler.Excelerate --version 6.0.1
NuGet\Install-Package DataJuggler.Excelerate -Version 6.0.1
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="DataJuggler.Excelerate" Version="6.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DataJuggler.Excelerate --version 6.0.1
#r "nuget: DataJuggler.Excelerate, 6.0.1"
#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 DataJuggler.Excelerate as a Cake Addin
#addin nuget:?package=DataJuggler.Excelerate&version=6.0.1

// Install DataJuggler.Excelerate as a Cake Tool
#tool nuget:?package=DataJuggler.Excelerate&version=6.0.1

<img height=192 width=192 src=https://github.com/DataJuggler/Blazor.Excelerate/blob/main/wwwroot/Images/ExcelerateLogoSmallWhite.png>

DataJuggler.Excelerate

Excelerate uses EPPPlus version 4.5.3.3 (last free version), and it makes it easy to load Workbooks or Worksheets.

I just released a Blazor project that is built using this project: Blazor.Excelerate https://github.com/DataJuggler/Blazor.Excelerate

Nuget package version 1.1.9 was just published: DataJuggler.Excelerate

A class named CodeGenerator was just created, and now by inheriting from the same CSharpClassWriter that code generates for DataTier.Net, I code generate classes based on your header row.

I have a couple of clients that I build programs that automate combining columns from multiple Worksheets to form reports.

Rather than continue to write custom loaders, I really only need custom Exporters in most cases.

Here is a short video: https://youtu.be/Sa-xroxPw_I

This short code snippet will load all the rows from a worksheet:

Snippet is from a Windows Form .Net 5 project, located in the Sample folder of this project. Very simple for now:

Load Worksheet Sample

using DataJuggler.UltimateHelper;
using DataJuggler.Excelerate;
using System;
using System.Windows.Forms;

// Set the text
string path = WorksheetControl.Text;

// Create a new instance of a 'LoadWorksheetInfo' object.
LoadWorksheetInfo loadWorksheetInfo = new LoadWorksheetInfo();

// Set the SheetName
oadWorksheetInfo.SheetName = SheetnameControl.SelectedObject.ToString();

// Only load the first 12 columns for this test
loadWorksheetInfo.ColumnsToLoad = 12;

// Set the LoadColumnOptions
loadWorksheetInfo.LoadColumnOptions = LoadColumnOptionsEnum.LoadFirstXColumns;

// other options
// loadWorksheetInfo.LoadColumnOptions = LoadColumnOptionsEnum.LoadAllColumnsExceptExcluded;
// loadWorksheetInfo.LoadColumnOptions = LoadColumnOptionsEnum.LoadSpecifiedColumns;

// load the worksheet
Worksheet worksheet = ExcelDataLoader.LoadWorksheet(path, loadWorksheetInfo);

// if the worksheet exists
if ((NullHelper.Exists(worksheet)) && (SheetnameControl.HasSelectedObject))
{
    // if the rows collection was found
    if (worksheet.HasRows)
    {
        // Show a message as a test
        // MessageBox.Show("Worksheet Loaded", "Finished");

        // test only
        // int rows = worksheet.Rows.Count;

        // Show a message as a test
        // MessageBox.Show("There were " + String.Format("{0:n0}",  rows) + " rows found in the worksheet");

        // int cols = worksheet.Rows[1124].Columns.Count;

        // Show a message as a test
        // MessageBox.Show("There were " + String.Format("{0:n0}",  cols) + " columns found in the row index 1125.");

        // Get a nullable date
        // string columnValue = worksheet.Rows[1124].Columns[3].DateValue;

        // Show a message of the columnValue
        // MessageBox.Show("Column Value: " + columnValue);
    }
}

There is now a Code Generator class built into this project, to code generate a C# class from a header row. 
The Code Generator has been updated to pass in a Row instance, to make loading the generate classes simple.

This code is from a Windows Form .Net 5 project located in the sample:

# Code Generation Sample

    // if the value for HasWorksheet is true
    if ((HasWorksheet) && (ListHelper.HasOneOrMoreItems(Worksheet.Rows)))
    {
        // The file I am using to test has 3 rows at the top above the header row. Take this out if I accidently check this in
        // worksheet.Rows.RemoveRange(0, 3);

        // Set the outputFolder
        string outputFolder = OutputFolderControl.Text;

        // Set the className (the name of the generated class)
        string className = "SalesTaxEntry";

        // Create a new instance of a CodeGenerator
        CodeGenerator codeGenerator = new CodeGenerator(worksheet, outputFolder, className);

        // Generate a class and set the Namespace
        bool success = codeGenerator.GenerateClassFromWorksheet("STATS.Objects");

        // Show the results
        MessageBox.Show("Success: " + success);
    }


There is another override to load multiple sheets at once. I will build a sample project when I get some time to build a sample spreadsheet I can give away.

To load multiple sheets:

List<LoadWorksheetInfo> loadWorkSheetsInfo = new List<LoadWorksheetInfo>();

// Add each LoadWorksheetInfo
workbook = ExcellDataLoader.LoadWorkbook(path, loadWorkSheetsInfo)

I will build some helper methods to save writing as much code once I use this a little to know what is needed.

My first test loaded a 12 column spreadsheet with 3,376 rows in just a few seconds.

I have a new project that uses this project as a good sample. Blazor.Excelerate will soon be an online way to create classes from a spreadsheet.

https://github.com/DataJuggler/Blazor.Excelerate

More helper methods and features will be added. The Nuget package has been released: DataJuggler.Excelerate.

Feel free to mention any new features you think would be useful. I can't promise to do them all, but if it is a good fit for this project I will add it.

This code is all brand new, so use with caution until more testing has been done. First tests have been promising.

I just finished adding a Load method, that is code generated when the classes are written.

** I am available for hire if you need help with any size C# / SQL Server project **

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DataJuggler.Excelerate:

Package Downloads
DataJuggler.Blazor.Components

A collection of components to make building a Blazor project simpler. This project consists of an ImageButton, ProgressBar, Sprite, Validation component, ComboBox, a CheckedListBox, Grid and a Label. The Label is new, and has only been tested a little. The CSS file DataJuggler.Blazor.Components.css contains many useful classes to help style and position objects. This version is for .Net 8.0. Version 8.0.0 This project has been updated to .NET 8. Use a 7.x version for .NET 7. All new development will be on the .NET 8 version. Version 7.13.5 Novermber 7, 2023: DataJuggler.Blazor.Components passed 100,000 Downloads I updated the Grid and created a new sample project to demo the Grid. A live demo is available at https://excelerate.datajuggler.com And the code for Blazor Excelerate is here: https://github.com/DataJuggler/Blazor.Excelerate (No Longer Uses Blazor Styled). This project has now removed Blazor Styled. .NET 8.0 is the only supported version going forward. New to version 1.3 is a new really cool progress bar that uses all CSS by http://circle.firchow.net/ by Andre Firchow, and his blog is here: http://firchow.net/

DataJuggler.SQLSnapshot

SQL Snapshot allows you to export a SQL Server database and all data rows to Excel with one line of code passing in a connectionstring and a path.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.4 823 12/29/2023
8.0.3 371 12/29/2023
8.0.2 1,239 12/26/2023
8.0.1 510 11/17/2023
8.0.0 1,235 11/14/2023
7.4.6 1,149 8/28/2023
7.4.5 1,248 8/26/2023
7.4.4 821 8/13/2023
7.4.3 420 8/13/2023
7.4.2 607 7/24/2023
7.4.1 408 7/24/2023
7.4.0 467 7/23/2023
7.3.21 602 7/22/2023
7.3.20 602 7/22/2023
7.3.1 432 7/21/2023
7.3.0 443 7/16/2023
7.2.12 2,137 4/10/2023
7.2.11 490 4/10/2023
7.2.10 496 4/5/2023
7.2.9 554 4/2/2023
7.2.8 503 4/2/2023
7.2.7 481 4/1/2023
7.2.6 490 3/28/2023
7.2.5 501 3/28/2023
7.2.4 485 3/28/2023
7.2.3 495 3/28/2023
7.2.2 471 3/28/2023
7.2.1 475 3/28/2023
7.2.0 491 3/28/2023
7.1.12 501 3/28/2023
7.1.11 487 3/28/2023
7.1.10 503 3/28/2023
7.1.9 8,312 12/25/2022
7.1.8 5,861 12/16/2022
7.1.7 607 12/16/2022
7.1.6 902 12/11/2022
7.1.5 796 12/11/2022
7.1.4 2,606 12/4/2022
7.1.3 770 12/4/2022
7.1.2 601 12/4/2022
7.1.1 797 12/4/2022
7.1.0 4,285 11/15/2022
7.0.16 1,128 11/11/2022
7.0.15 648 11/11/2022
7.0.14 644 11/11/2022
7.0.12 625 11/11/2022
7.0.11 636 11/11/2022
7.0.10 603 11/10/2022
7.0.9 825 11/10/2022
7.0.8 625 11/10/2022
7.0.7 611 11/10/2022
7.0.6 617 11/10/2022
7.0.5 607 11/9/2022
7.0.4 824 11/9/2022
7.0.4-rc1 417 11/8/2022
7.0.3-rc1 453 11/7/2022
7.0.2-rc1 501 11/7/2022
7.0.1-rc1 409 11/7/2022
7.0.0-rc1 406 10/31/2022
6.0.3 868 9/28/2022
6.0.2 710 9/28/2022
6.0.1 968 4/1/2022
6.0.0 956 1/23/2022
1.7.3 710 11/30/2021
1.7.2 595 11/30/2021
1.7.1 596 11/30/2021
1.7.0 616 11/30/2021
1.6.0 577 11/29/2021
1.5.0 686 11/10/2021
1.4.4 703 11/8/2021
1.4.3 616 11/8/2021
1.4.2 642 11/8/2021
1.4.1 626 11/8/2021
1.4.0 628 11/8/2021
1.3.12 595 11/7/2021
1.3.10 632 11/7/2021
1.3.9 683 11/7/2021
1.3.8 712 11/7/2021
1.3.7 708 11/7/2021
1.3.6 762 11/7/2021
1.3.5 706 11/5/2021
1.3.4 706 11/5/2021
1.3.3 686 11/5/2021
1.3.2 717 11/5/2021
1.3.1 629 11/2/2021
1.3.0 612 11/2/2021
1.2.8 660 11/1/2021
1.2.7 618 10/31/2021
1.2.6 620 10/31/2021
1.2.5 698 10/31/2021
1.2.4 721 10/31/2021
1.2.3 693 10/31/2021
1.2.2 663 10/31/2021
1.2.1 661 10/31/2021
1.2.0 719 10/31/2021
1.1.9 612 10/16/2021
1.1.8 691 10/16/2021
1.1.7 649 10/14/2021
1.1.6 625 10/13/2021
1.1.5 659 9/21/2021
1.1.4 653 9/20/2021
1.1.3 640 9/20/2021
1.1.2 662 9/17/2021
1.1.1 640 9/17/2021
1.0.3 578 9/15/2021
1.0.2 604 9/14/2021
1.0.1 614 9/14/2021
1.0.0 621 9/14/2021

4.1.2022: Version 6.0.1: I added ExcludedColumnIndexes. I have a project for a client and I need to skip two columns.
This is brand new code, and not tested, so use with caution for now. April Fools, my code always works the 1st time!

1.23.2022: This project was updated to .NET6.

11.30.2021 (Take Four)
Version 1.7.3: I fixed IsHeaderRow is set to true for the top row, for data that is loaded in LoadAllData which calls LoadWorksheet.
Now the Load list method checks for the row is not a header row.

11.30.2021 (Take Three)
Version 1.7.2: I changed an if statement to a compound if in CodeGenerator.cs (in the Load List override), and I forgot to
add an extra opening paren. Computers are so picky.

11.30.2021 (Take Two)
Version 1.7.1: I realized the Load method for a list, needed row.Number > 1 and row.HasColumns, because of the
header row means you need to skeep the first row.

11.30.2021
Version 1.7.0: I added a new feature to code generate a Load method override, that accepts a worksheet parameter,
and will load a list of objects now. Saves writing a load method for each worksheet, now one line of code can take car of it.

11.10.2021 (Take Two)
Version 1.5.1: .Net6.0 won't open the file. Testing with .Net 5.0.

11.10.2021
Version 1.5.0: Package now supports mullti-targeting net5.0 and net6.0.

11.8.2021 (Take Four)
Version 1.4.2: My code generated NewRowMethod, used row.Columns.Add(column) instead of newRow.Columns.Add(column). I fixed this to use the variable name newRow.

11.8.2021 (Take Four)
Version 1.4.3: I fixed a stack overflow error (that I caused).

11.8.2021 (Take Three)
Version 1.4.1: I realized I had to add a using statement reference for DataJuggler.Net5
to the code generated classes.

11.8.2021 (Take Two)
Version 1.4.0: The Add New Method code generation appears to work.
I am updating Blazor Excelerate with this version and will continue to test.

11.8.2021
Version 1.3.14: First attempt at code generating the NewRow method.

11.7.2021 (Take Two)
Version 1.3.12: I added two new features:
1. ColumnValue for a boolean column, can now be exported as 0 or 1 (instead of True / False).
To use this, set ExportBooleanAsOneOrZero to true, and the DataType must be a DataManager.DataTypes.Boolean
2. I added a FindColumn method to the row object, to make setting ExportBooleanAsOneOrZero easier.

11.7.2021
Version 1.3.10: BooleanHelper, part of DataJuggler.UltimateHelper had a bug in the ParseBoolean method.

11.6.2021 (Take Four)
Version 1.3.9: I set StringValue to an empty string if an error occurrs.

11.6.2021 (Take Three)
Version 1.3.8: Before 1.3.7 Nuget package email arrived that it was ready, I realized I needed to
create the WorksheetInfo object in the constructor also.

11.6.2021 (Take Two)
Version 1.3.7: While working on Excelerate.WinForms.Deo, I realized I needed to create the Updates collection
and I decided it saved two lines of code in my demo to do this in the constructor.

11.6.2021
Version 1.3.6: I created two new methods SaveBatch and SaveBatchItem.

SaveBatch represents saving data from multple worksheets
SaveBatchItem represents saving data from one worksheet.

Both of these methods are untested, so at this time use with caution.

11.4.2021 (Take Four)
Version 1.3.5: I had forgotten to add saved = true to ExcelHelper.Save method at the end of the Save method.

11.4.2021 (Take Three)
Version 1.3.4: I discovered too late the ExcelHelper.Save method is not static.

11.4.2021 (Take Two)
Version 1.3.3: My previous Save method had the return value in the wrong place.

Hopefully this fixes it. I am too lazy to add the project and propertly debug it.

11.4.2021
Version 1.3.2: While working on Save I realized I needed to return the row from the code generated Save method
so Excel can be updated. Save is still being tested, so use with caution.

11.2.2021 (Take Two)
Version 1.3.1: The previous version code generated the Save method incorrectly. This should fix it.

11.2.2021
Version 1.3.0: I now code generate a Save method, so the current Row.Column's ColumnValues are updated with the current value of this object.

11.1.2021
Version 1.2.8: I updated Worksheet.Columns is now set to first row.Columns when the Worksheet is loaded.
I added a NewRow method, that returns a new row with the columns set.
I updated AttemptToDetermineDataType to set ZipCode and PostalCode fields to a string, not an integer.

Code Generating a Save method is next I think.

10.31.2021 (Take Eight)
This time, DataJuggler.UlimateHelper was updated. The ParseBoolean method got an upgrade.

10.31.2021 (Take Seven)
Version 1.2.6: I updated ParseBoolean to use DataJuggler.UltimateHelper.BooleanHelper.ParseBoolean. We will see if this converts a 1 to a true and a zero to a false. I think it does after 11 years.

10.31.2021: (Take Six)
Version 1.2.5: I fixed Active being a boolean, and discovered the LoadMethod was trying to set bool columns to a string value.

10.31.2021: (Take Five)
Version 1.2.4: I fixed the Active field = boolean. I need an else so the data type didn't get set to Int further in the AttemptToDetermineDataType method.

10.31.2021: (Take Four)
Version 1.2.3: Added a check for data type boolean. To make this work, convert Excel bool values to True False vs 0 and 1.

10.31.2021 (Take Three)
Version 1.2.2: Code generation is fixed with a reference to System is needed since Guid RowId has been added.

10.31.2021 (Take Two)
Version 1.2.1: I messed up the code generation in Version 1.2.0 because the RowId field wasn't getting a field name written. Should work now.

10.31.2021:
Version 1.2.0: The code generation of the RowId seems to work, so the 1.2 version starts the Saving features.

10.31.2021
Version 1.1.10: I added RowNumber and Id (Guid) to class Row to help in saving, which I am just starting.

10.16.2021
Version 1.1.9: I added a new method LoadAllData, which returns a DataJuggler.Excelerate.Workbook, which contains all DataJuggler.Excelerate.Worksheets, which contain all DataJuggler.Excelerate.Rows of data.

10.16.2021:
Version 1.1.8: AppendPartialGuid is now an optional parameter, and only if true will the partial guid be appended to the filename.


10.14.2021:
Version 1.1.7: CodeGenerator.GenerateClassFromWorksheet now returns an object of type CodeGenerationResponse. Previous version only returns a boolean, which wasn't very helpful for the caller.

10.13.2021: New override for GetSheetNames takes a path argument.
I am working on a new Blazor project called Blazor.Excelerate to demo this project.

9.21.2021
Version 1.1.5:
I created an ExcelHelper class because I needed the GetColumnLetter feature of ExcelCellAddress.

9.20.2021
Version 1.1.4:
I updated ExcelDataLoader to havea  LoadPackage method.

9.20.2021:
Version 1.1.3:
I added an OriginalFileName property to class Column, so the exported column header can be the same as the original.

9.17.2021
Version 1.1.2:
The Code Generator class is now finished, and a Load method has been updated to test for
a null row or null row.Columns just to be safer.

More updates may come in the future, but for now I have completed what I started this project for.
For the amount of effort I put into this, I think the return on investment is quite satisfactory as
now I can build Excel projects much faster.

9.17.2021
Version 1.1.1: I now code generate a Load method with the Code Generator, so a Row can be used to load an instance of the class created. This is still being tested.

9.15.2021
Version 1.0.3: I added a LoadWorksheet override, so clients do not have to load a Workbook to get
to a single worksheet.

This is the first release. I have just begun adding classes and helper methods to this. It does work for now to load a worksheet and all the Rows / Columns. Each column is loaded as an object ColumnValue, than properties exist that cast the ColumnValue as a bool, datetime, Decimal or other types.