An extension library for ClosedXML to allow for quick and easy bulk data extraction from Excel Workbooks into various formats.
To see an example of this library is used check out the XLSXBulkDataExtractor Desktop Application.
NuGets
Name | Link |
---|---|
XLSX_Data_Extractor | NuGet Link |
XLSXDataExtractor.Common | NuGet Link |
Two components are included. The DataExtractor class which is used to extract data out from Worksheets of a loaded Workbook, and the ExtractedDataConverter static class which is used to convert the extracted data into various formats, such as a CSV or XLSX document.
The DataExtractor contains multiple overloads for single data extraction using the worksheets known name, column, and row of the data. Or, an ExtractionRequest object can be passed to it containing the same information. For bulk data extraction a collection of ExtractionRequest objects can be passed to it, an example of this is shown below.
DataExtractor dataExtractor = new DataExtractor(Path.Combine(executingAssemblyPath, "Files", "IntegrationTestExample.xlsx"));
var extractionRequests = new List<ExtractionRequest>() { new ExtractionRequest("SalesRep", 2, 3), new ExtractionRequest("SalesRepID", 2, 2) };
var extracted = dataExtractor.RetrieveDataCollectionFromAllWorksheets<object>(extractionRequests);
This is a static class than converts a two dimensional collection of the KeyValuePair objects produced from the various extraction methods into a string of CSV text or a IXLWorksheet to be used with the ClosedXML library.