Click or drag to resize
ExcelFileLoad Method (String)
Loads a spreadsheet from a file with the specified path.

Namespace: GemBox.Spreadsheet
Assembly: GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version: 41.3.30.1000
Syntax
public static ExcelFile Load(
	string path
)

Parameters

path
Type: SystemString
The path from which to load a spreadsheet.

Return Value

Type: ExcelFile
A loaded spreadsheet.
Remarks
File extension that is extracted from the path is used to create the appropriate LoadOptions derived class instance that is then passed to the Load(String, LoadOptions) method.

Following file extensions are supported:

  • Microsoft Excel: .xlsx, xlsm, .xltx, .xltm, .xls, .xlt
  • OpenDocument Spreadsheet: .ods, .ots
  • Character Separated Values: .csv, .tsv
  • HyperText Markup Language: .htm, .html, .mht, .mhtml
Examples

Following code demonstrates different ways of loading ExcelFile.

// Loads a spreadsheet from a file with the specified path
ExcelFile ef = ExcelFile.Load(fileName);

using (FileStream stream = new FileStream(fileName, FileMode.Open))
{
    // Loads a spreadsheet from the specified stream
    ef = ExcelFile.Load(stream, LoadOptions.XlsxDefault);
}

// Loads a spreadsheet using specified options
ef = ExcelFile.Load(fileName, new XlsxLoadOptions() { PreserveUnsupportedFeatures = false });
See Also