Table of Contents

Class MiniExcel

Namespace
MiniExcelLibs
Assembly
MiniExcel.dll
public static class MiniExcel
Inheritance
MiniExcel
Inherited Members

Fields

LISENCE_CODE

public static string LISENCE_CODE

Field Value

string

Methods

ConvertCsvToXlsx(Stream, Stream)

public static void ConvertCsvToXlsx(Stream csv, Stream xlsx)

Parameters

csv Stream
xlsx Stream

ConvertCsvToXlsx(string, string)

public static void ConvertCsvToXlsx(string csv, string xlsx)

Parameters

csv string
xlsx string

ConvertXlsxToCsv(Stream, Stream)

public static void ConvertXlsxToCsv(Stream xlsx, Stream csv)

Parameters

xlsx Stream
csv Stream

ConvertXlsxToCsv(string, string)

public static void ConvertXlsxToCsv(string xlsx, string csv)

Parameters

xlsx string
csv string

GetColumns(Stream, bool, string, ExcelType, string, IConfiguration)

public static ICollection<string> GetColumns(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

ICollection<string>

GetColumns(string, bool, string, ExcelType, string, IConfiguration)

public static ICollection<string> GetColumns(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

ICollection<string>

GetReader(Stream, bool, string, ExcelType, string, IConfiguration)

public static MiniExcelDataReader GetReader(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

MiniExcelDataReader

GetReader(string, bool, string, ExcelType, string, IConfiguration)

public static MiniExcelDataReader GetReader(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

MiniExcelDataReader

GetSheetInformations(Stream, OpenXmlConfiguration)

public static List<SheetInfo> GetSheetInformations(this Stream stream, OpenXmlConfiguration config = null)

Parameters

stream Stream
config OpenXmlConfiguration

Returns

List<SheetInfo>

GetSheetInformations(string, OpenXmlConfiguration)

public static List<SheetInfo> GetSheetInformations(string path, OpenXmlConfiguration config = null)

Parameters

path string
config OpenXmlConfiguration

Returns

List<SheetInfo>

GetSheetNames(Stream, OpenXmlConfiguration)

public static List<string> GetSheetNames(this Stream stream, OpenXmlConfiguration config = null)

Parameters

stream Stream
config OpenXmlConfiguration

Returns

List<string>

GetSheetNames(string, OpenXmlConfiguration)

public static List<string> GetSheetNames(string path, OpenXmlConfiguration config = null)

Parameters

path string
config OpenXmlConfiguration

Returns

List<string>

Insert(Stream, object, string, ExcelType, IConfiguration)

public static void Insert(this Stream stream, object value, string sheetName = "Sheet1", ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null)

Parameters

stream Stream
value object
sheetName string
excelType ExcelType
configuration IConfiguration

Insert(string, object, string, ExcelType, IConfiguration)

public static void Insert(string path, object value, string sheetName = "Sheet1", ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null)

Parameters

path string
value object
sheetName string
excelType ExcelType
configuration IConfiguration

MergeSameCells(Stream, byte[], ExcelType, IConfiguration)

public static void MergeSameCells(this Stream stream, byte[] filePath, ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null)

Parameters

stream Stream
filePath byte[]
excelType ExcelType
configuration IConfiguration

MergeSameCells(Stream, string, ExcelType, IConfiguration)

public static void MergeSameCells(this Stream stream, string path, ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null)

Parameters

stream Stream
path string
excelType ExcelType
configuration IConfiguration

MergeSameCells(string, string, ExcelType, IConfiguration)

public static void MergeSameCells(string mergedFilePath, string path, ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null)

Parameters

mergedFilePath string
path string
excelType ExcelType
configuration IConfiguration

MergeSameCellsAsync(Stream, byte[], ExcelType, IConfiguration, CancellationToken)

public static Task MergeSameCellsAsync(this Stream stream, byte[] fileBytes, ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
fileBytes byte[]
excelType ExcelType
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

MergeSameCellsAsync(Stream, string, ExcelType, IConfiguration, CancellationToken)

public static Task MergeSameCellsAsync(this Stream stream, string path, ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
path string
excelType ExcelType
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

MergeSameCellsAsync(string, string, ExcelType, IConfiguration, CancellationToken)

public static Task MergeSameCellsAsync(string mergedFilePath, string path, ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

mergedFilePath string
path string
excelType ExcelType
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

Query(Stream, bool, string, ExcelType, string, IConfiguration)

public static IEnumerable<dynamic> Query(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

IEnumerable<dynamic>

Query(string, bool, string, ExcelType, string, IConfiguration)

public static IEnumerable<dynamic> Query(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

IEnumerable<dynamic>

QueryAsDataTable(Stream, bool, string, ExcelType, string, IConfiguration)

public static DataTable QueryAsDataTable(this Stream stream, bool useHeaderRow = true, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

DataTable

QueryAsDataTable(string, bool, string, ExcelType, string, IConfiguration)

[Obsolete("QueryAsDataTable is not recommended, because it'll load all data into memory.")]
public static DataTable QueryAsDataTable(string path, bool useHeaderRow = true, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

DataTable

QueryAsDataTableAsync(Stream, bool, string, ExcelType, string, IConfiguration, CancellationToken)

[Obsolete("QueryAsDataTable is not recommended, because it'll load all data into memory.")]
public static Task<DataTable> QueryAsDataTableAsync(this Stream stream, bool useHeaderRow = true, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<DataTable>

QueryAsDataTableAsync(string, bool, string, ExcelType, string, IConfiguration, CancellationToken)

[Obsolete("QueryAsDataTable is not recommended, because it'll load all data into memory.")]
public static Task<DataTable> QueryAsDataTableAsync(string path, bool useHeaderRow = true, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<DataTable>

QueryAsync(Stream, bool, string, ExcelType, string, IConfiguration, CancellationToken)

public static Task<IEnumerable<dynamic>> QueryAsync(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<IEnumerable<dynamic>>

QueryAsync(string, bool, string, ExcelType, string, IConfiguration, CancellationToken)

public static Task<IEnumerable<dynamic>> QueryAsync(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<IEnumerable<dynamic>>

QueryAsync<T>(Stream, string, ExcelType, string, IConfiguration, CancellationToken)

public static Task<IEnumerable<T>> QueryAsync<T>(this Stream stream, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default) where T : class, new()

Parameters

stream Stream
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<IEnumerable<T>>

Type Parameters

T

QueryAsync<T>(string, string, ExcelType, string, IConfiguration, CancellationToken)

public static Task<IEnumerable<T>> QueryAsync<T>(string path, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null, CancellationToken cancellationToken = default) where T : class, new()

Parameters

path string
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task<IEnumerable<T>>

Type Parameters

T

QueryRange(Stream, bool, string, ExcelType, string, string, IConfiguration)

public static IEnumerable<dynamic> QueryRange(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "a1", string endCell = "", IConfiguration configuration = null)

Parameters

stream Stream
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
endCell string
configuration IConfiguration

Returns

IEnumerable<dynamic>

QueryRange(string, bool, string, ExcelType, string, string, IConfiguration)

public static IEnumerable<dynamic> QueryRange(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "a1", string endCell = "", IConfiguration configuration = null)

Parameters

path string
useHeaderRow bool
sheetName string
excelType ExcelType
startCell string
endCell string
configuration IConfiguration

Returns

IEnumerable<dynamic>

Query<T>(Stream, string, ExcelType, string, IConfiguration)

public static IEnumerable<T> Query<T>(this Stream stream, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null) where T : class, new()

Parameters

stream Stream
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

IEnumerable<T>

Type Parameters

T

Query<T>(string, string, ExcelType, string, IConfiguration)

public static IEnumerable<T> Query<T>(string path, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null) where T : class, new()

Parameters

path string
sheetName string
excelType ExcelType
startCell string
configuration IConfiguration

Returns

IEnumerable<T>

Type Parameters

T

SaveAs(Stream, object, bool, string, ExcelType, IConfiguration)

public static void SaveAs(this Stream stream, object value, bool printHeader = true, string sheetName = "Sheet1", ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null)

Parameters

stream Stream
value object
printHeader bool
sheetName string
excelType ExcelType
configuration IConfiguration

SaveAs(string, object, bool, string, ExcelType, IConfiguration, bool)

public static void SaveAs(string path, object value, bool printHeader = true, string sheetName = "Sheet1", ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null, bool overwriteFile = false)

Parameters

path string
value object
printHeader bool
sheetName string
excelType ExcelType
configuration IConfiguration
overwriteFile bool

SaveAsAsync(Stream, object, bool, string, ExcelType, IConfiguration, CancellationToken)

public static Task SaveAsAsync(this Stream stream, object value, bool printHeader = true, string sheetName = "Sheet1", ExcelType excelType = ExcelType.XLSX, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
value object
printHeader bool
sheetName string
excelType ExcelType
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

SaveAsAsync(string, object, bool, string, ExcelType, IConfiguration, bool, CancellationToken)

public static Task SaveAsAsync(string path, object value, bool printHeader = true, string sheetName = "Sheet1", ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null, bool overwriteFile = false, CancellationToken cancellationToken = default)

Parameters

path string
value object
printHeader bool
sheetName string
excelType ExcelType
configuration IConfiguration
overwriteFile bool
cancellationToken CancellationToken

Returns

Task

SaveAsByTemplate(Stream, byte[], object, IConfiguration)

public static void SaveAsByTemplate(this Stream stream, byte[] templateBytes, object value, IConfiguration configuration = null)

Parameters

stream Stream
templateBytes byte[]
value object
configuration IConfiguration

SaveAsByTemplate(Stream, string, object, IConfiguration)

public static void SaveAsByTemplate(this Stream stream, string templatePath, object value, IConfiguration configuration = null)

Parameters

stream Stream
templatePath string
value object
configuration IConfiguration

SaveAsByTemplate(string, byte[], object, IConfiguration)

public static void SaveAsByTemplate(string path, byte[] templateBytes, object value, IConfiguration configuration = null)

Parameters

path string
templateBytes byte[]
value object
configuration IConfiguration

SaveAsByTemplate(string, string, object, IConfiguration)

public static void SaveAsByTemplate(string path, string templatePath, object value, IConfiguration configuration = null)

Parameters

path string
templatePath string
value object
configuration IConfiguration

SaveAsByTemplateAsync(Stream, byte[], object, IConfiguration, CancellationToken)

public static Task SaveAsByTemplateAsync(this Stream stream, byte[] templateBytes, object value, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
templateBytes byte[]
value object
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

SaveAsByTemplateAsync(Stream, string, object, IConfiguration, CancellationToken)

public static Task SaveAsByTemplateAsync(this Stream stream, string templatePath, object value, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

stream Stream
templatePath string
value object
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

SaveAsByTemplateAsync(string, byte[], object, IConfiguration, CancellationToken)

public static Task SaveAsByTemplateAsync(string path, byte[] templateBytes, object value, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

path string
templateBytes byte[]
value object
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task

SaveAsByTemplateAsync(string, string, object, IConfiguration, CancellationToken)

public static Task SaveAsByTemplateAsync(string path, string templatePath, object value, IConfiguration configuration = null, CancellationToken cancellationToken = default)

Parameters

path string
templatePath string
value object
configuration IConfiguration
cancellationToken CancellationToken

Returns

Task