HI,
I am using VS 2012, ASP.NET, C#.
I am reading the contents of excel document and adding to a datatable using the oledb connection.
Is it possible to only query the sheets in Excel which has data in it programmatically? My current code reads all the sheets, irrespective of the sheet having data or not. Below is the code used :
using (OleDbConnection Connection = new OleDbConnection(SourceConstr))
{
Connection.Open();
//get all the available sheets
System.Data.DataTable dtSheetname = new System.Data.DataTable();
dtSheetname = Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
//get the number of sheets in the file
workSheetNames = new String[dtSheetname.Rows.Count];
int i = 0;
foreach ...
Go to the complete details ...