{"id":13430527,"url":"https://github.com/DataJuggler/Blazor.Excelerate","last_synced_at":"2025-03-16T05:31:20.952Z","repository":{"id":142975722,"uuid":"416587642","full_name":"DataJuggler/Blazor.Excelerate","owner":"DataJuggler","description":"This Blazor project uses DataJuggler.Blazor.Components and DataJuggler.Excelerate to code generate C# classes from Excel worksheets","archived":false,"fork":false,"pushed_at":"2025-02-10T19:00:21.000Z","size":12023,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T20:19:43.869Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataJuggler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-13T04:24:07.000Z","updated_at":"2025-02-10T19:00:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"f40e3cb3-8ce7-441d-a6b0-dd178f4ec1c3","html_url":"https://github.com/DataJuggler/Blazor.Excelerate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FBlazor.Excelerate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FBlazor.Excelerate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FBlazor.Excelerate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FBlazor.Excelerate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataJuggler","download_url":"https://codeload.github.com/DataJuggler/Blazor.Excelerate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T02:00:54.905Z","updated_at":"2025-03-16T05:31:20.942Z","avatar_url":"https://github.com/DataJuggler.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"\r\n5.18.2024: New Video\r\n\r\nFirst Ever Opensource Saturday - Sunday Edition\r\nhttps://youtu.be/uxa1xR6xpzk\r\n\r\n7.24.2023: New Video\r\n\r\nThe Best C# Excel Library In The Galaxy\r\nhttps://youtu.be/uWXiz52cqlg\r\n\r\n\u003cimg src =https://excelerate.datajuggler.com/Images/LogoTextSparkled.png\u003e\u003cbr\u003e\r\nCode Generate C# Classes From Excel Header Rows\r\n\r\n\u003cimg src =https://excelerate.datajuggler.com/Images/ExcelerateLogoSmallWhite.png width=\"128\" height=\"128\"\u003e\r\n\r\nLive Demo:\r\n\u003ca href=https://excelerate.datajuggler.com target=\"_blank\"\u003ehttps://excelerate.datajuggler.com\u003c/a\u003e\r\n\r\nBlazor Excelerate is an open source Blazor demo for Nuget DataJuggler.Excelerate, which is built on top of NPOI.\r\nInstructions (copied from Index.razor.cs)\r\n1. Prepare your spreadsheet (save as .xlsx extension) and ensure you have a header row, and the column names make good property names. \r\n   Download MemberData.xlsx to see an example (Downloads\\MemberData.xlsx comes with this project and contains 20,000 random names and addresses).\r\n   \r\n2. Click the Upload button to upload your spreadsheet and select the sheet to code generate a class for.\r\n\r\n   \u003cimg src =https://github.com/DataJuggler/SharedRepo/blob/master/Shared/Images/ExcelerateStep1.png\u003e\u003cbr\u003e\r\n   \r\n3. Type in a namespace for your project and select the sheet in the Sheets ComboBox then click the 'Generate Class' button.\r\n\r\n    \u003cimg src =https://github.com/DataJuggler/SharedRepo/blob/master/Shared/Images/ExcelerateStep2.png\u003e\u003cbr\u003e\r\n    \r\n4. Download the zip file and extract the contents to get your C# file.\r\n\r\n   \u003cimg src =https://github.com/DataJuggler/SharedRepo/blob/master/Shared/Images/ExcelerateStep3.png\u003e\u003cbr\u003e\r\n\r\nTips / Troubleshooting\r\nIt helps to have some rows of data to attempt to determine the data type. Getting the data type is kind of a hack.\r\n\r\n# News\r\n\r\nUpdate 7.24.2023:\r\n\r\nI created a WinForms (desktop) app that can be installed via NuGet and the dotnet CLI\r\n\r\nTo Install Via Nuget and DOT NET CLI, navigate to the folder you wish to create your project in\r\n\r\n    cd c:\\Projects\\ExcelerateWinApp\r\n    dotnet new install DataJuggler.ExcelerateWinApp\r\n    dotnet new DataJuggler.ExcelerateWinApp\r\n\r\nor\r\n\r\nClone this project from GitHub https://github.com/DataJuggler/ExcelerateWinApp\r\n\r\n# Setup Instructions for ExcelerateWinApp, copied from the above project.\r\n\r\n1. Create one or more classes from Excel Header Rows at\u003cbr\u003e\u003cbr\u003e\r\n\r\nBlazor Excelerate\u003cbr\u003e\r\nhttps://excelerate.datajuggler.com\u003cbr\u003e\r\n\r\nDownload the file MemberData.xlsx from the above site to see an example.\r\nUse ExcelerateWinApp.Objects for the namespace or rename this project to your liking\r\n \r\n2. Copy the classes created into the Objects folder of ExcelerateWinApp\r\n\r\n3. Load Excel Worksheet(s) - Example is included in the UpdateButton_Click event\r\n\t\r\n       // load your object(s)\r\n       string workbookPath = FileSelector.Text;\r\n\r\n       // Example WorksheetInfo objects           \r\n       WorksheetInfo info = new WorksheetInfo();\r\n       info.LoadColumnOptions = LoadColumnOptionsEnum.LoadAllColumnsExceptExcluded;\r\n       info.Path = workbookPath;\t\r\n\r\n       // Set your SheetName\r\n       info.SheetName = \"Address\";\r\n\r\n       // Example WorksheetInfo objects           \r\n       WorksheetInfo info2 = new WorksheetInfo();\r\n       info2.LoadColumnOptions = LoadColumnOptionsEnum.LoadAllColumnsExceptExcluded;\r\n       info2.Path = workbookPath;\r\n\r\n       // Set the SheetName for info2\r\n       info2.SheetName = 'States\";\r\n\r\n       // Example load Worksheets\r\n       Worksheet addressWorksheet = ExcelDataLoader.LoadWorksheet(workbookPath, info);\r\n       Worksheet statesWorksheet = ExcelDataLoader.LoadWorksheet(workbookPath, info2);\r\n\r\n5. Load your list of objects\r\n \r\n        // Examples loading the Address and States sheet from MemberData.xlsx\r\n        List\u003cAddress\u003e addresses = Address.Load(addressWorksheet);\r\n        List\u003cStates\u003e states = States.Load(statesWorksheet);\r\n\r\n6. Perform updates on your List of objects\r\n\r\n   For this example, I inserted a column StateName into the Address sheet in Excel and\r\n   added a few state names manually. You must add a few entries so the data type can be\r\n   attempted to be determined. Then I code generated Address and States classes using\r\n   Blazor Excelerate\u003cbr\u003e\r\n   https://excelerate.datajuggler.com\r\n\r\n   This method set the Address.StateName for each row by looking up the State Name by StateId\r\n\t\r\n       /// \u003csummary\u003e\r\n       /// Lookup the StateName for each Address object by StateId\r\n       /// \u003c/summary\u003e\r\n       public void FixStateNames(ref List\u003cAddress\u003e addresses, List\u003cStates\u003e states)\r\n       {\r\n           // verify both lists exists and have at least one item\r\n           if (ListHelper.HasOneOrMoreItems(addresses, states))\r\n           {\r\n              // Iterate the collection of Address objects\r\n              foreach (Address address in addresses)\r\n              {\r\n                  // get a local copy\r\n                  int stateId = address.StateId;\r\n\r\n                  // set the stateName\r\n                  address.StateName = states.Where(x =\u003e x.Id == stateId).FirstOrDefault().Name;\r\n\r\n                  // Increment the value for Graph\r\n                  Graph.Value++;\r\n\r\n                  // update the UI every 100\r\n                  if (Graph.Value % 100 == 0)\r\n                  {\r\n                      Refresh();\r\n                      Application.DoEvents();\r\n                   }\r\n              }\r\n           }\r\n        }\r\n\t\r\n7. Save your worksheet back to Excel\r\n\r\n       // resetup the graph                    \r\n       Graph.Maximum = addresses.Count;\r\n       Graph.Value = 0;\r\n\r\n       // change the text\r\n       StatusLabel.Text = \"Saving Addresses please wait...\";\r\n\r\n       // you must convert the list objects to List\u003cIExcelerateObject\u003e before it can be saved\r\n       List\u003cIExcelerateObject\u003e excelerateObjectList = addresses.Cast\u003cIExcelerateObject\u003e().ToList();\r\n\r\n       // Now save the worksheet\r\n       SaveWorksheetResponse response = ExcelHelper.SaveWorksheet(excelerateObjectList, addressWorksheet, info, SaveWorksheetCallback, 500);\r\n\r\n8. (Optional) Leave a Star on DataJuggler.Excelerate, Blazor Excelerate or this project on GitHub\r\n\r\n    DataJuggler.Excelerate\r\n    https://github.com/DataJuggler/Excelerate\r\n\r\n    Blazor Excelerate\r\n    https://github.com/DataJuggler/Blazor.Excelerate\r\n\t\r\n    Excelerate Win App\r\n    https://github.com/DataJuggler/ExcelerateWinApp\r\n\r\n9. (Optional) Subscribe to my YouTube channel\r\n    https://youtube.com/DataJuggler\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataJuggler%2FBlazor.Excelerate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDataJuggler%2FBlazor.Excelerate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataJuggler%2FBlazor.Excelerate/lists"}