DataJuggler.Excelerate
6.0.2
See the version list below for details.
dotnet add package DataJuggler.Excelerate --version 6.0.2
NuGet\Install-Package DataJuggler.Excelerate -Version 6.0.2
<PackageReference Include="DataJuggler.Excelerate" Version="6.0.2" />
paket add DataJuggler.Excelerate --version 6.0.2
#r "nuget: DataJuggler.Excelerate, 6.0.2"
// Install DataJuggler.Excelerate as a Cake Addin #addin nuget:?package=DataJuggler.Excelerate&version=6.0.2 // Install DataJuggler.Excelerate as a Cake Tool #tool nuget:?package=DataJuggler.Excelerate&version=6.0.2
<img height=192 width=192 src=https://github.com/DataJuggler/Blazor.Excelerate/blob/main/wwwroot/Images/ExcelerateLogoSmallWhite.png>
DataJuggler.Excelerate
Update 4.1.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.
I just released a Blazor project that is built using this project: Blazor.Excelerate https://github.com/DataJuggler/Blazor.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 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 | 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. |
-
net6.0
- DataJuggler.Net6 (>= 6.0.4)
- EPPlus (>= 4.5.3.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DataJuggler.Excelerate:
Package | Downloads |
---|---|
DataJuggler.Blazor.Components
This project consists of a TextBoxComponent, Multiline TextBox, CheckBox, ComboBox, CheckedListComboBox, CheckedListBox, Grid, Label, Calendar Component, Time Component and more. The CSS file DataJuggler.Blazor.Components.css contains many useful classes to help style and position objects. This version is for .Net 9.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.1 | 314 | 11/26/2024 |
9.0.0 | 204 | 11/13/2024 |
8.0.10 | 673 | 9/13/2024 |
8.0.9 | 525 | 9/11/2024 |
8.0.8 | 2,150 | 5/19/2024 |
8.0.7 | 114 | 5/19/2024 |
8.0.6 | 117 | 5/19/2024 |
8.0.5 | 522 | 5/4/2024 |
8.0.4 | 1,284 | 12/29/2023 |
8.0.3 | 430 | 12/29/2023 |
8.0.2 | 1,342 | 12/26/2023 |
8.0.1 | 581 | 11/17/2023 |
8.0.0 | 1,783 | 11/14/2023 |
7.4.6 | 1,239 | 8/28/2023 |
7.4.5 | 1,340 | 8/26/2023 |
7.4.4 | 887 | 8/13/2023 |
7.4.3 | 454 | 8/13/2023 |
7.4.2 | 664 | 7/24/2023 |
7.4.1 | 442 | 7/24/2023 |
7.4.0 | 507 | 7/23/2023 |
7.3.21 | 648 | 7/22/2023 |
7.3.20 | 661 | 7/22/2023 |
7.3.1 | 472 | 7/21/2023 |
7.3.0 | 488 | 7/16/2023 |
7.2.12 | 2,249 | 4/10/2023 |
7.2.11 | 533 | 4/10/2023 |
7.2.10 | 542 | 4/5/2023 |
7.2.9 | 600 | 4/2/2023 |
7.2.8 | 544 | 4/2/2023 |
7.2.7 | 525 | 4/1/2023 |
7.2.6 | 531 | 3/28/2023 |
7.2.5 | 534 | 3/28/2023 |
7.2.4 | 519 | 3/28/2023 |
7.2.3 | 528 | 3/28/2023 |
7.2.2 | 507 | 3/28/2023 |
7.2.1 | 507 | 3/28/2023 |
7.2.0 | 524 | 3/28/2023 |
7.1.12 | 538 | 3/28/2023 |
7.1.11 | 525 | 3/28/2023 |
7.1.10 | 531 | 3/28/2023 |
7.1.9 | 8,591 | 12/25/2022 |
7.1.8 | 6,035 | 12/16/2022 |
7.1.7 | 642 | 12/16/2022 |
7.1.6 | 947 | 12/11/2022 |
7.1.5 | 841 | 12/11/2022 |
7.1.4 | 2,698 | 12/4/2022 |
7.1.3 | 814 | 12/4/2022 |
7.1.2 | 640 | 12/4/2022 |
7.1.1 | 834 | 12/4/2022 |
7.1.0 | 4,416 | 11/15/2022 |
7.0.16 | 1,165 | 11/11/2022 |
7.0.15 | 689 | 11/11/2022 |
7.0.14 | 680 | 11/11/2022 |
7.0.12 | 662 | 11/11/2022 |
7.0.11 | 671 | 11/11/2022 |
7.0.10 | 639 | 11/10/2022 |
7.0.9 | 867 | 11/10/2022 |
7.0.8 | 661 | 11/10/2022 |
7.0.7 | 645 | 11/10/2022 |
7.0.6 | 650 | 11/10/2022 |
7.0.5 | 638 | 11/9/2022 |
7.0.4 | 863 | 11/9/2022 |
7.0.4-rc1 | 452 | 11/8/2022 |
7.0.3-rc1 | 483 | 11/7/2022 |
7.0.2-rc1 | 528 | 11/7/2022 |
7.0.1-rc1 | 436 | 11/7/2022 |
7.0.0-rc1 | 446 | 10/31/2022 |
6.0.3 | 928 | 9/28/2022 |
6.0.2 | 745 | 9/28/2022 |
6.0.1 | 1,022 | 4/1/2022 |
6.0.0 | 1,005 | 1/23/2022 |
1.7.3 | 757 | 11/30/2021 |
1.7.2 | 633 | 11/30/2021 |
1.7.1 | 631 | 11/30/2021 |
1.7.0 | 648 | 11/30/2021 |
1.6.0 | 624 | 11/29/2021 |
1.5.0 | 726 | 11/10/2021 |
1.4.4 | 737 | 11/8/2021 |
1.4.3 | 666 | 11/8/2021 |
1.4.2 | 680 | 11/8/2021 |
1.4.1 | 664 | 11/8/2021 |
1.4.0 | 666 | 11/8/2021 |
1.3.12 | 632 | 11/7/2021 |
1.3.10 | 664 | 11/7/2021 |
1.3.9 | 715 | 11/7/2021 |
1.3.8 | 752 | 11/7/2021 |
1.3.7 | 743 | 11/7/2021 |
1.3.6 | 797 | 11/7/2021 |
1.3.5 | 741 | 11/5/2021 |
1.3.4 | 740 | 11/5/2021 |
1.3.3 | 715 | 11/5/2021 |
1.3.2 | 751 | 11/5/2021 |
1.3.1 | 663 | 11/2/2021 |
1.3.0 | 643 | 11/2/2021 |
1.2.8 | 695 | 11/1/2021 |
1.2.7 | 655 | 10/31/2021 |
1.2.6 | 651 | 10/31/2021 |
1.2.5 | 729 | 10/31/2021 |
1.2.4 | 763 | 10/31/2021 |
1.2.3 | 726 | 10/31/2021 |
1.2.2 | 692 | 10/31/2021 |
1.2.1 | 689 | 10/31/2021 |
1.2.0 | 746 | 10/31/2021 |
1.1.9 | 648 | 10/16/2021 |
1.1.8 | 727 | 10/16/2021 |
1.1.7 | 686 | 10/14/2021 |
1.1.6 | 658 | 10/13/2021 |
1.1.5 | 691 | 9/21/2021 |
1.1.4 | 690 | 9/20/2021 |
1.1.3 | 674 | 9/20/2021 |
1.1.2 | 697 | 9/17/2021 |
1.1.1 | 671 | 9/17/2021 |
1.0.3 | 608 | 9/15/2021 |
1.0.2 | 637 | 9/14/2021 |
1.0.1 | 649 | 9/14/2021 |
1.0.0 | 681 | 9/14/2021 |
9.28.2022: I improved the DataType scoring. Before I had a few hard coded items, but today
I built a DataTypeScorer to look at 25 data rows for a column and attempt to determine the data type.
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.