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 8591803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:36:21+00:00 2026-06-11T23:36:21+00:00

I am trying to pull a bunch of data from a spreadsheet, however I

  • 0

I am trying to pull a bunch of data from a spreadsheet, however I am not able to make a successful connection in my C# code. B

Below is the connection string and the code that I am using to make the connection. The goal of the program is to pull the data from the spreadsheet and deposit it into a SQL database. I cannot get past the connection.open() command, however without receiveing this error message:

“External table is not in the expected format”

        string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\nearod\Desktop\TestLoad.xlsx;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";
        string queryString = "SELECT * FROM [SQL AgentUnique ID Test Load$]";
        try
        {
            OleDbDataReader reader;
            using (OleDbConnection connection = new OleDbConnection(connectionString))
            {

                OleDbCommand command = new OleDbCommand(queryString, connection);
                connection.Open();
                reader = command.ExecuteReader();


                while (reader.Read())
                {
                    counter++;

                    //Access db values
                    string compCode = "";
                    string agId = "";
                    string fName = "";
                    string lName = "";
                    string nameSuffix = "";


                    compCode = reader.GetValue(0).ToString();
                    agId = reader.GetString(1);
                    fName = reader.GetString(2);
                    lName = reader.GetString(3);
                    nameSuffix = reader.GetString(4);

                    sqlComm.Parameters.Add(companyCode);
                    sqlComm.Parameters.Add(agentID);
                    sqlComm.Parameters.Add(firstName);
                    sqlComm.Parameters.Add(lastName);
                    sqlComm.Parameters.Add(suffix);

                    //Initialize connection objects
                    cm = Dts.Connections["QUAHILSQ03"];
                    sqlConn = (SqlConnection)cm.AcquireConnection(Dts.Transaction);
                    sqlComm = new SqlCommand("AgentResourcesU01.dbo.sp_AgentIdAprCheck", sqlConn);
                    sqlComm.CommandType = CommandType.StoredProcedure;

                    //Execute stored procedure
                    sqlComm.ExecuteNonQuery();

                }
                reader.Close();
                connection.Close();
                OleDbConnection.ReleaseObjectPool();
            }
  • 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-06-11T23:36:22+00:00Added an answer on June 11, 2026 at 11:36 pm

    For *.xlsx, you need the Ace drivers: Microsoft.ACE.OLEDB.12.0

    string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;
     Data Source=C:\Users\nearod\Desktop\TestLoad.xlsx;
     Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pull data from the YouTube API into a local MySQL table.
I'm trying to pull a value out of the url query string however I
Trying to pull the text from a label on the page but it's not
Trying to pull rows from a table and list them in an ol, however,
I am trying to pull 1 week data from sql server, then trying to
I'm trying to pull some html data from a mysql database to populate a
I am trying to pull data from DBF files into my program using C#.
I'm trying to pull some data from MySQL using an Array that was fetch
I am trying pull a field out of a string and return it. My
Just trying to pull off some SMART info from connected Hard Drives on any

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.