Click here to Skip to main content
14,543,534 members
Rate this:
Please Sign up or sign in to vote.
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:[^]
Updated 6-Apr-19 22:39pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100