Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 950565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:35:14+00:00 2026-05-15T23:35:14+00:00

I just started C# today, and i have trouble reading an excel file. Here’s

  • 0

I just started C# today, and i have trouble reading an excel file.

Here’s what i did :

OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + @";Extended Properties=""Excel 12.0;HDR=YES;""");

OleDbCommand command = new OleDbCommand("SELECT * FROM [Sheet$]", connection);

connection.Open();

OleDbDataReader reader = command.ExecuteReader();

And i have an exception saying it can’t find “Sheet$”
(i can’t copy/paste the exception, because the message is in french, and i don’t know yet how to have generic messages in english)

Could someone tell me what did i do wrong ?

I followed what they say in tutorials or like here Reading Excel files from C#

Thanks, really !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:35:14+00:00Added an answer on May 15, 2026 at 11:35 pm

    You can get a list of “Tables” (worksheets or named ranges) from your Excel file:

    DataTable schema = connection.GetSchema(OleDbMetaDataCollectionNames.Tables);
    

    The TABLE_NAME field is the one you should use in your query. If the value has single quotes around it, you’ll need to include those. For example, my file has worksheets named “GP” and “Kimberly Clark”. In the schema table, they appear as “GP$” and “‘Kimberly Clark$'”. In a query, I would reference them as “[GP$]” or “[‘Kimberly Clark$’]”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to python and just started learning it today. I have installed
I have just started playing with the ASP.Net MVC framework, and today I created
I just started reading Effective C++ today and got to the point where the
I've just started learning Python today. I've been reading a Byte of Python. Right
I'm (extremely) new to Ruby, having started today. I just moved from my system's
The problem I have just started today, without really changing the code at all.
I just started working with the Flickr API today and I have a question:
So I'm really really really new to PHP and MySQL (just started today!). I
I just started learning Python today. I have a list: [text:u'Oranges', text:u'Apples', empty:'', empty:'']
I have just started developing a Grails app froma tutorial today, and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.