jimmychippewa
asked on
Using VB .Net to parse an excel file
Hi
I am current writting a VB .Net app that needs to do the following:
open an existing excel workbook and select a worksheet
search the cells in one column for a string
continue searching the cells in the same column for another string
copy the cells between both strings and push them into a db
I've having difficulty finguring out how to search the cells into order to create the range object, w/o creating the range object to begin wth.
I haven't worked with the Excel object model before so any assistance would be appreciated
I am current writting a VB .Net app that needs to do the following:
open an existing excel workbook and select a worksheet
search the cells in one column for a string
continue searching the cells in the same column for another string
copy the cells between both strings and push them into a db
I've having difficulty finguring out how to search the cells into order to create the range object, w/o creating the range object to begin wth.
I haven't worked with the Excel object model before so any assistance would be appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
private DataSet TranslatExcelToDataset(str
{
string ConnectionString = string.Format("Provider=Mi
OleDbConnection Connection = new OleDbConnection(Connection
OleDbDataAdapter Adapter = new OleDbDataAdapter();
OleDbCommand Command = new OleDbCommand("SELECT * FROM [Sheet1$]", Connection);
DataSet DS = new DataSet("Table");
Adapter.SelectCommand = Command;
Adapter.Fill(DS);
return DS;
}