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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:12:22+00:00 2026-05-31T21:12:22+00:00

I have an excel sheet that I want to load into a datatable withe

  • 0

I have an excel sheet that I want to load into a datatable withe OleDb.
The sheet contains a multiline text column with up to 1000 chars.

However, using this code below, I only have 256 chars in my DataTable per cell after the import.

Is this a limitation from the provider or is it possible to tell it to read the whole column?

var connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\file.xlsx;Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";";
var sheetName = "Sheet1";

using (var con = new OleDbConnection(connectionString))
{
    con.Open();

    var table = new DataTable(sheetName);
    var query = "SELECT * FROM [" + sheetName + "]";
    OleDbDataAdapter adapter = new OleDbDataAdapter(query, con);
    adapter.Fill(table);
    return table;
}
  • 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-31T21:12:23+00:00Added an answer on May 31, 2026 at 9:12 pm

    I found a solution.

    The problem is that OleDb is guessing, which dbtype to choose.
    And, if the first few rows only contain data shorter than 256 chars, that is applied to all rows.

    Howevery, as a workaround I just moved one row with large data to the beginning of the sheet and now the whole data gets imported.

    Here is a link that describes the problem. There is also a workaround with a registry key, but I haven’t tried that.

    http://www.xtremevbtalk.com/showthread.php?t=206454

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

Sidebar

Related Questions

I have a sheet in Excel. One column in it (ID) contains strings with
I've got a excel sheet that contains all the employees that have worked for
I have data that I want to have written into a Microsoft Excel File.
I have an excel sheet full of times. They are formatted so that they
I have the this code that will create excel file and work sheet then
I have an Excel sheet with two column, one is a number , and
The title says it: I have an excel Sheet with an column full of
I have a powerpoint pres that grabs some data from an excel sheet when
I have an excel sheet and on column J, I have a start number
I have a excel sheet with 7 fields. I want to remove/filter all 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.