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

  • SEARCH
  • Home
  • 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 744621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:59:57+00:00 2026-05-14T08:59:57+00:00

I am using ASP.NET to open an Excel 2003 document hosted on the server.

  • 0

I am using ASP.NET to open an Excel 2003 document hosted on the server. The excel spreadsheet, produced by a system outside of my control, has 5 named worksheets. I access the data in each sheet as follows (line breaks added for readability):

string ExcelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\sample.xls;
    Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1;\";";

OleDbDataAdapter myData = 
    new OleDbDataAdapter("SELECT * FROM [mysheet]", ExcelConn);
myData.TableMappings.Add("Table", "mysheet");
myData.Fill(ExcelDS);

This works for 3 of the 5 sheets. The other two throw this error:

The Microsoft Jet database engine
could not find the object ‘mysheet’.
Make sure the object exists and that
you spell its name and the path name
correctly.

I have quadruple-checked the sheet name by examining the text in the bottom tab and also by examining the end of the string that this produces in Excel:

=CELL("filename")
c:\[sample.xls]mysheet

The connection string is specified once and reused for all 5 sheets.

Is it possible that I need to reference the sheet with a string that doesn’t match the name that is visible in Excel? Maybe hidden characters, spaces, etc.? Is there another way to find the true name of the sheet? Any other suggestions for retrieving this data?

Note: I cannot modify the Excel document (I would have used SSIS to import CSV if I could have it my way).

I’m using .NET 3.5 / II6.

  • 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-14T08:59:58+00:00Added an answer on May 14, 2026 at 8:59 am

    Well, I found a way to uncover the actual name of the sheet.

    Using the connection string in the question, I can do this…

    OleDbConnection conn = new OleDbConnection(ExcelConn);
    conn.Open();
    ...
    conn.Close();
    

    With the connection open, I can use the debugger to retrieve the sheet names.

    conn.GetSchema("Tables").Rows[0]["TABLE_NAME"]
    conn.GetSchema("Tables").Rows[1]["TABLE_NAME"]
    ...
    conn.GetSchema("Tables").Rows[9]["TABLE_NAME"]
    

    I found that there were 10 sheet names in the Excel document. The 2 sheets that were causing errors had similar names post-fixed with a “$”. I think I’m in for a support nightmare as I’m willing to bet someone played with the Excel document before sending it to me – but at least I know how to pull the data.

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

Sidebar

Related Questions

Using iTextSharp (and c#/ASP.NET) is it possible to open an RTF document, manipulate it
Using ASP.net, what methods can I use to do the following: Open up a
Through an C#/ASP.NET website, I'm using SpreadsheetGear to open a file from a template,
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
I'm using asp.net but open to using any language for doing this. I've seen
Using asp.net mvc2 on vs2008 on local machine and hosting on a shared server
I am using asp.net 3.5. My Hosting provider has given me a folder to
I am using ASP.NET to read the data in the excel file. I am
I am using ASP.NET with SQL Server 2005. My date get saved in the

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.