Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating a console application (Scheduler) which triggers emails regularly.

here I want to read an excel file, how to implement this.
step by step solution will be appreciated,

Not understanding how to use the below connection string-

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";


What I have tried:

this is the article I'm referring to implement this: https://www.aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-using-ADO.Net-and-C.aspx[^]
Posted
Updated 6-Apr-19 22:39pm

1 solution

To use that, you need to have the Access ACE engine V12 installed on your machine, and the correct version for the app you are using: a 64 bit app requires the 64 bit engine; a 32 bit app requires the 32 bit version. You can then use the connections string to construct an OledbConnection object, open it, and use OledbCommand objects to access it as if it was a database.

However, there are simpler ways to read XLSX files: C# How To Read .xlsx Excel File With 3 Lines of Code[^] for example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900