SpreadJS Documentation > Developer's Guide > Managing Data > Using the Excel Import and Export Component > Excel Import Classes |
The following methods and properties can be used when importing from an Excel-formatted file when using the Excel assemblies.
Class | Description |
GrapeCity.Spread.Sheets.ExcelIO.Importer | Represents an importer that enables a file to be imported. |
Method | Description |
public Importer() | Represents an importer that enables a file to be imported. |
Method | Description |
public string ImportExcel(Stream stream, ExcelOpenFlags flags = ExcelOpenFlags.NoFlagsSet, string password = null) | Opens an Excel Compound Document File and loads it into GCSpreadSheets. |
Parameters | |
stream | The stream that contains an Excel Compound Document File. |
flags | The options of the Excel-compatible file to be loaded (default value is "NoFlagsSet"). |
password | The password which is required for the encrypted Excel file. |
Remarks: For performance considerations, this method suspends all events during the file load. |
Method | Description |
public string ImportCsv(Stream stream) | Loads the CSV file with the specified separator, with or without headers, with the specified encoding. |
Parameter | |
stream | The stream from which to load data. |
Method | Description |
public string ImportCsv(Stream stream, TextFileOpenFlags flags) | Loads the CSV file with the specified separator, with or without headers, with the specified encoding. |
Parameter | |
stream | The stream from which to load data. |
flags | The options for opening csv and plain text files (default value is "None"). |
Method | Description |
public string ImportCsv(Stream stream, TextFileOpenFlags flags, string encoding, string rowDelimiter, string columnDelimiter, string cellDelimiter | Loads the CSV file with the specified separator, with or without headers, with the specified encoding. |
Parameters | |
stream | The stream from which to load data. |
flags | The options for opening csv and plain text files (default value is "None"). |
encoding | The code page name of the preferred encoding which is registered with the Internet Assigned Numbers Authority (IANA), for opening a CSV or plain text file (default value is UTF8). |
rowDelimiter | The row delimiter string when opening the text file (default value is "\r\n"). |
columnDelimiter | The column delimiter string when opening the text file (default value is ","). |
cellDelimiter | The cell delimiter string when opening the text file (default value is '"'). |
Method | Description |
public string ImportText(Stream stream) | Loads delimited text from a specified stream into the sheet. |
Parameter | |
stream | The stream from which to load. |
Method | Description |
public string ImportText(Stream stream, TextFileOpenFlags flags) | Loads delimited text from a specified stream into the sheet. |
Parameters | |
stream | The stream from which to load. |
flags | The options for opening csv and plain text files (default value is "None"). |
Method | Description |
public string ImportText(Stream stream, TextFileOpenFlags flags, string rowDelimiter, string columnDelimiter, string cellDelimiter) | Loads delimited text from a specified stream into the sheet. |
Parameters | |
stream | The stream from which to load. |
flags | The options for opening csv and plain text files (default value is "None"). |
rowDelimiter | The row delimiter string when opening the text file (default value is "\r\n"). |
columnDelimiter | The column delimiter string when opening the text file (default value is ","). |
cellDelimiter | The cell delimiter string when opening the text file (default value is '"'). |
Property | Description |
public string ErrorMessage { get; set; } | Gets or sets the error message string. |
Return value | The error message is set to this property if the import fails. |