DataJuggler.Excelerate
9.0.0
dotnet add package DataJuggler.Excelerate --version 9.0.0
NuGet\Install-Package DataJuggler.Excelerate -Version 9.0.0
<PackageReference Include="DataJuggler.Excelerate" Version="9.0.0" />
paket add DataJuggler.Excelerate --version 9.0.0
#r "nuget: DataJuggler.Excelerate, 9.0.0"
// Install DataJuggler.Excelerate as a Cake Addin #addin nuget:?package=DataJuggler.Excelerate&version=9.0.0 // Install DataJuggler.Excelerate as a Cake Tool #tool nuget:?package=DataJuggler.Excelerate&version=9.0.0
<img height=192 width=192 src=https://github.com/DataJuggler/Blazor.Excelerate/blob/main/wwwroot/Images/ExcelerateLogoSmallWhite.png>
Live Demo
Blazor.Excelerate https://excelerate.datajuggler.com Code Generate C# Classes From Excel Header Rows
Major Update - EPPPlus has been removed and NPOI has replaced it.
This was a pretty major switch, but EPPPlus had vulnerabilities in the last free version. I will be testing more in the near future, as I suspect there may be some issues switching from one based EPPPlus to 0 based in NPOI may not have been converted correctly.
Update 5.18.2024
New Video:
First Ever Opensource Saturday - Sunday Edition https://youtu.be/uxa1xR6xpzk
Updates
11.13.2024: EPPPlus was removed and NPOI has replaced it. This project was updated to .NET9. This version is still beiing tested. Use a version 8.x for now.
9.11.2024: I updated NuGet package DataJuggler.UltimateHelper. I became aware this package is listed as having vulnerabilities, which I believe stem from using EPPPlus version 4.5.3.3 which is the last free version of EPPPlus.
Edit 11.13.2024: NPOI has now replaced EPPPlus
12.29.2023: DataJuggler.Net8 was updated.
12.26.2023: Updated DataJuggler.NET8 and this project to handle Target Framework of .NET8
11.14.2023: This project has been updated to .NET8.
8.13.2023: DataJuggler.UltimateHelper was updated.
7.24.2023: New Video
The Best C# Excel Library In The Galaxy https://youtu.be/uWXiz52cqlg
I also created a NuGet package for a WinForms project that includes all the needed packages and has a progress bar wired up.
DataJuggler.ExcelerateWinApp
Install Instructions
To Install Via Nuget and DOT NET CLI, navigate to the folder you wish to create your project in
cd c:\Projects\ExcelerateWinApp dotnet new install DataJuggler.ExcelerateWinApp dotnet new DataJuggler.ExcelerateWinApp or
Clone ExcelerateWinApp from GitHub https://github.com/DataJuggler/ExcelerateWinApp
7.22.2023: I have completed ExcelHelper.SaveWorksheet method. This is a major milestone so I have updated the project to 7.4.0.
7.22.2023: I am in the process of redoing SaveRow for the code generated objects. Now each class has two properties created. Loading, and ChangedColumns, which is a comma delimited string of column indexes that have chagned. The next phase will be only saving columns that have changes.
7.21.2023: I added a property to the column object called HasChanges. In conjunection with this the class ExcelHelper has an optional parameter to SaveBatch, SaveBatchItem and SaveRow to only save columns with HasChanges = true. For now, you have to set this property on the column manually. I am investigating ways to auto set this if the value changes from the time you loaded the object until you save it.\
7.16.2023: DataJuggler.UltimateHelper, DataJuggler.Net7 was updated.
Update 4.4.2023
I just released a cool project that uses this package.
DataJuggler.SQLSnapshot Export a SQL Server database and all data rows with just a connection string and the path to save the Excel file. Nuget DataJuggler.SQLSnapshot https://github.com/DataJuggler/SQLSnapshot
And a demo project for the above project https://github.com/DataJuggler/DemoSQLSnapshot
Update 11.11.2022: I am working on the Grid, and added a properties to the column object
and some code to the ValidationComponent to allow SetFocusOnFirstRender.
Update 11.9.2022 - 11.10.2022:
I added some new properties and enumerations for editing data in the Grid in DataJuggler.Blazor.Components.
Update 11.8.2022:
I added some new properties to the row and Column object for use with the Grid for DataJuggler.Blazor.Components.
Update 10.31.2022:
LoadWorksheetInfo.ExcludedColumnIndexes was added. This is a collection of integers to not load. I may expand this to column names also as an option.
--
Excelerate uses EPPPlus version 4.5.3.3 (last free version), and it makes it easy to load Workbooks or Worksheets.
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 6 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- DataJuggler.Net8 (>= 8.0.8)
- DataJuggler.UltimateHelper (>= 8.1.3)
- NPOI (>= 2.7.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DataJuggler.Excelerate:
Package | Downloads |
---|---|
DataJuggler.Blazor.Components
This project consists of an ImageButton, ProgressBar, Sprite, TextBoxComponent which can display as a TextBox, Multi-line TextBox or a CheckBox, a ComboBox, CheckedListComboBox, CheckedListBox, Grid, Label and a brand new Calendar Component. The CSS file DataJuggler.Blazor.Components.css contains many useful classes to help style and position objects. This version is for .Net 8.0. |
|
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 |
---|---|---|
9.0.0 | 177 | 11/13/2024 |
8.0.10 | 584 | 9/13/2024 |
8.0.9 | 450 | 9/11/2024 |
8.0.8 | 1,993 | 5/19/2024 |
8.0.7 | 108 | 5/19/2024 |
8.0.6 | 111 | 5/19/2024 |
8.0.5 | 505 | 5/4/2024 |
8.0.4 | 1,268 | 12/29/2023 |
8.0.3 | 426 | 12/29/2023 |
8.0.2 | 1,338 | 12/26/2023 |
8.0.1 | 564 | 11/17/2023 |
8.0.0 | 1,767 | 11/14/2023 |
7.4.6 | 1,233 | 8/28/2023 |
7.4.5 | 1,334 | 8/26/2023 |
7.4.4 | 883 | 8/13/2023 |
7.4.3 | 450 | 8/13/2023 |
7.4.2 | 660 | 7/24/2023 |
7.4.1 | 438 | 7/24/2023 |
7.4.0 | 503 | 7/23/2023 |
7.3.21 | 645 | 7/22/2023 |
7.3.20 | 657 | 7/22/2023 |
7.3.1 | 468 | 7/21/2023 |
7.3.0 | 482 | 7/16/2023 |
7.2.12 | 2,245 | 4/10/2023 |
7.2.11 | 529 | 4/10/2023 |
7.2.10 | 538 | 4/5/2023 |
7.2.9 | 596 | 4/2/2023 |
7.2.8 | 540 | 4/2/2023 |
7.2.7 | 521 | 4/1/2023 |
7.2.6 | 527 | 3/28/2023 |
7.2.5 | 530 | 3/28/2023 |
7.2.4 | 515 | 3/28/2023 |
7.2.3 | 524 | 3/28/2023 |
7.2.2 | 503 | 3/28/2023 |
7.2.1 | 503 | 3/28/2023 |
7.2.0 | 520 | 3/28/2023 |
7.1.12 | 534 | 3/28/2023 |
7.1.11 | 521 | 3/28/2023 |
7.1.10 | 527 | 3/28/2023 |
7.1.9 | 8,587 | 12/25/2022 |
7.1.8 | 6,031 | 12/16/2022 |
7.1.7 | 638 | 12/16/2022 |
7.1.6 | 943 | 12/11/2022 |
7.1.5 | 837 | 12/11/2022 |
7.1.4 | 2,694 | 12/4/2022 |
7.1.3 | 810 | 12/4/2022 |
7.1.2 | 636 | 12/4/2022 |
7.1.1 | 830 | 12/4/2022 |
7.1.0 | 4,412 | 11/15/2022 |
7.0.16 | 1,161 | 11/11/2022 |
7.0.15 | 685 | 11/11/2022 |
7.0.14 | 676 | 11/11/2022 |
7.0.12 | 658 | 11/11/2022 |
7.0.11 | 667 | 11/11/2022 |
7.0.10 | 633 | 11/10/2022 |
7.0.9 | 863 | 11/10/2022 |
7.0.8 | 657 | 11/10/2022 |
7.0.7 | 641 | 11/10/2022 |
7.0.6 | 646 | 11/10/2022 |
7.0.5 | 634 | 11/9/2022 |
7.0.4 | 859 | 11/9/2022 |
7.0.4-rc1 | 450 | 11/8/2022 |
7.0.3-rc1 | 481 | 11/7/2022 |
7.0.2-rc1 | 526 | 11/7/2022 |
7.0.1-rc1 | 432 | 11/7/2022 |
7.0.0-rc1 | 444 | 10/31/2022 |
6.0.3 | 924 | 9/28/2022 |
6.0.2 | 741 | 9/28/2022 |
6.0.1 | 1,018 | 4/1/2022 |
6.0.0 | 1,000 | 1/23/2022 |
1.7.3 | 753 | 11/30/2021 |
1.7.2 | 629 | 11/30/2021 |
1.7.1 | 627 | 11/30/2021 |
1.7.0 | 644 | 11/30/2021 |
1.6.0 | 620 | 11/29/2021 |
1.5.0 | 722 | 11/10/2021 |
1.4.4 | 733 | 11/8/2021 |
1.4.3 | 662 | 11/8/2021 |
1.4.2 | 676 | 11/8/2021 |
1.4.1 | 660 | 11/8/2021 |
1.4.0 | 662 | 11/8/2021 |
1.3.12 | 628 | 11/7/2021 |
1.3.10 | 660 | 11/7/2021 |
1.3.9 | 711 | 11/7/2021 |
1.3.8 | 748 | 11/7/2021 |
1.3.7 | 739 | 11/7/2021 |
1.3.6 | 793 | 11/7/2021 |
1.3.5 | 737 | 11/5/2021 |
1.3.4 | 736 | 11/5/2021 |
1.3.3 | 711 | 11/5/2021 |
1.3.2 | 747 | 11/5/2021 |
1.3.1 | 659 | 11/2/2021 |
1.3.0 | 639 | 11/2/2021 |
1.2.8 | 691 | 11/1/2021 |
1.2.7 | 651 | 10/31/2021 |
1.2.6 | 647 | 10/31/2021 |
1.2.5 | 725 | 10/31/2021 |
1.2.4 | 759 | 10/31/2021 |
1.2.3 | 722 | 10/31/2021 |
1.2.2 | 688 | 10/31/2021 |
1.2.1 | 685 | 10/31/2021 |
1.2.0 | 742 | 10/31/2021 |
1.1.9 | 644 | 10/16/2021 |
1.1.8 | 723 | 10/16/2021 |
1.1.7 | 680 | 10/14/2021 |
1.1.6 | 654 | 10/13/2021 |
1.1.5 | 687 | 9/21/2021 |
1.1.4 | 685 | 9/20/2021 |
1.1.3 | 670 | 9/20/2021 |
1.1.2 | 693 | 9/17/2021 |
1.1.1 | 667 | 9/17/2021 |
1.0.3 | 604 | 9/15/2021 |
1.0.2 | 633 | 9/14/2021 |
1.0.1 | 645 | 9/14/2021 |
1.0.0 | 677 | 9/14/2021 |
See Read Me