[]
Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".
public static string[] GetNames(string fileName)
Public Shared Function GetNames(fileName As String) As String()
| Type | Name | Description |
|---|---|---|
| string | fileName | The path and name for the file. |
| Type | Description |
|---|---|
| string[] | An array of possible import names. |
Workbook sourceWorkbook = new Workbook();
IWorksheet sheet = sourceWorkbook.Worksheets[0];
sheet.Range["A1:B2"].Value = new object[,] { { "Item", "Value" }, { "Sales", 100 } };
ITable table = sheet.Tables.Add(sheet.Range["A1:B2"], true);
table.Name = "SalesTable";
string fileName = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), ".xlsx"));
sourceWorkbook.Save(fileName);
string[] names = Workbook.GetNames(fileName);
Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".
public static string[] GetNames(Stream fileStream)
Public Shared Function GetNames(fileStream As Stream) As String()
| Type | Name | Description |
|---|---|---|
| Stream | fileStream | The fileStream of a workbook. |
| Type | Description |
|---|---|
| string[] | An array of possible import names. |
Workbook sourceWorkbook = new Workbook();
IWorksheet sheet = sourceWorkbook.Worksheets[0];
sheet.Range["A1:B2"].Value = new object[,] { { "Item", "Value" }, { "Sales", 100 } };
ITable table = sheet.Tables.Add(sheet.Range["A1:B2"], true);
table.Name = "SalesTable";
using (MemoryStream stream = new MemoryStream())
{
sourceWorkbook.Save(stream);
stream.Position = 0;
string[] names = Workbook.GetNames(stream);
}