How to get list of ONLY excel worksheet names in Excel using OLEDB; filter out non-worksheets that show up in metadata

前端 未结 4 2215
眼角桃花
眼角桃花 2020-12-28 22:05

I have an issue getting worksheet names from an Excel spreadsheet using OLEDB. The problem is that when I use GetOleDbSchemaTable, the resulting DataTable has more than jus

4条回答
  •  温柔的废话
    2020-12-28 22:14

    The first way that comes to my mind is the same way akash88 listed in your link to Using Excel OleDb to get sheet names IN SHEET ORDER link.

    You can take akash88's approach and clean it up a little so the code is nicer to read.

            var wsList = from s in schemaTable
                         where s.Field("TABLE_NAME").Contains("$")
                         select s.Field("TABLE_NAME");
    

提交回复
热议问题