Skip to content

DiegoPiovezana/SheetHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet

Veja a documentação em português clicando aqui.

SheetHelper

Fast and lightweight library for easy read and conversion of large Excel files.

AVAILABLE FEATURES:
✔ Compatible with reading .xlsx, .xlsm, .xls, .xlsb, .csv, .txt, .rpt files, among others;
✔ Get a datatable from a spreadsheet using the GetDataTable method;
✔ Use SaveDataTable to save dataTable in different formats and with restriction of columns and rows;
✔ Use the CloseExcel method to close all Excel processes, even those in the background;
✔ Use GetIndexColumn to get the column index by giving the name (e.g. "AB");
✔ The GetNameColumn method can be used to get the column name;
✔ Use GetRowArray to get a row of a DataTable;
✔ Convert a array to a DataRow using the ConverToDataRow method;
✔ Convert a spreadsheet to different formats using the Converter method;
✔ Allows to convert ranges of rows. Eg: "1:23, -34:56, 70:40, 75, -1";
✔ Possibility to convert ranges of columns. Eg: "A:H, 4:9, 4:-9, B, 75, -2";
✔ Replaces file if already converted;
✔ Option to choose the desired sheet for conversion using index or name (no sensitive case);
✔ Can choose the file format to be converted;
✔ Option to choose the file name, destination location and format to be saved;
✔ Allowed to change the delimiter;
✔ Supports conversion of hidden columns, rows, and sheets;
✔ Possibility to choose specific columns and rows to be converted;
✔ Allows you to track the percentage of completion through the Progress property;
✔ Has handling for end user when file not found with MessageBox for NetFramework;
✔ Supports unzipping of .GZ (using UnGZ) and .ZIP (using UnZIP) files. Or use UnzipAuto to unzip automatically.


Uses the library ExcelDataReader to perform the reading.


CONTACT:

https://bit.ly/FeedbackHappyHelper



MAIN POSSIBLE CONVERSIONS:

INSTALLATION:

 dotnet add package SheetHelper

EXAMPLE OF USE:

using SH;

namespace App
{
    static class Program
    {
        static void Main()
        {
            string source  = "C:\\Users\\Diego\\Files\\Report.xlsx.gz";
            string destination = "C:\\Users\\Diego\\Files\\Report.csv";

            string sheet = "1"; // Use "1" for the first sheet (index or name)
            string delimiter  = ";";
            string columns  = "A, 3, b, 12:-1"; // or null to convert all columns or "A:BC" for a column range
            string rows = ":4, -2"; // Eg: Extracts from the 1nd to the 4nd row and also the penultimate row      

            bool success = SheetHelper.Converter(source, destination, sheet, delimiter, columns, rows);           

            Console.WriteLine(success ? "The file was converted successfully!" : "Failed to convert the file!")
        }
    }
}