public string[] GetWorksheetList()
{
var set = new HashSet<string>();
using (var connection = new OleDbConnection(strConnection))
{
connection.Open();
var table = connection.GetSchema("Tables");
for (int i = 0; i < table.Rows.Count; i++)
{
string name = (string)table.Rows[i]["TABLE_NAME"];
// removes the trailing $ and other characters appended in the table name
while (name.EndsWith("$", StringComparison.Ordinal)
|| name.EndsWith("$\"", StringComparison.Ordinal)
|| name.EndsWith("$\'", StringComparison.Ordinal)
|| name.EndsWith("$\"\'", StringComparison.Ordinal)
|| name.EndsWith("$\'\"", StringComparison.Ordinal))
name = name.Remove(name.Length - 1).Trim('"', '\'');
set.Add(name);
}
}
this.worksheets = new List<string>(set).ToArray();
return worksheets;
}