Created
June 5, 2017 18:13
-
-
Save nkundu/3c75e60282111acc5e971bbb8a236d32 to your computer and use it in GitHub Desktop.
Query a Excel File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; data source={0}; Extended Properties=\"Excel 8.0;IMEX=1\"", fullfilename); | |
DataSet ds = new DataSet(); | |
using (OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString)) | |
{ | |
adapter.Fill(ds, "contactRecords"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment