LinqToExcel icon indicating copy to clipboard operation
LinqToExcel copied to clipboard

LinqToExcel data retrieval problem

Open paulhawkins opened this issue 10 years ago • 10 comments

I have a csv File in which the 5th column contains mixed types.

capture

When i query this through LinqToExcel

           var excel = new ExcelQueryFactory(@"C:\Dataloader\2.csv");                                
            var AcountAttributes = from AA in excel.Worksheet(0)
                                   select AA;

it doesn't return data for the column when the value is text? What am i doing wrong?

capture2

Thanks Paul

paulhawkins avatar Dec 08 '14 12:12 paulhawkins

I am having the same issue.. any fix?

bloomk avatar Jan 07 '15 20:01 bloomk

Also having same issue.

Nesse avatar Jan 15 '15 14:01 Nesse

I think this happens because ACE and JET sample the column to determine a type before the data gets to LinqToExcel. Usually I would expect it to take to type it finds from the top rows but maybe here it's determined that the column is integers and so omits values that it can't convert.

Astrophizz avatar Jan 25 '15 04:01 Astrophizz

i am also facing same issue. Any fix?

neerajkd avatar Jul 07 '16 11:07 neerajkd

I have had this issue as well. Astrophizz is correct that it attempts to determine the type, i cannot find the article... but I recall that it does some "Magic" on the first 10 rows of a column to determine the Type.. The only way that I have resolved it is to make sure the Excel columns themselves are specifically set to "Text". And in the Code itself, i always treat them as a string and then convert them.

MorbidKoder avatar Jul 07 '16 16:07 MorbidKoder

As @MorbidKoder mentioned, that was the solution I needed to use as well.

nicolas-stephens avatar Dec 14 '16 16:12 nicolas-stephens

I am having Text column in Excel with numbers in it. "Number" in cca 280 row has value 3;4 and I am getting NUll. How someone can force data to be read as text/string not integers/numbers? Having column set to Text and numbers aligned to left does not solve my problem.

gregorjovan avatar Apr 12 '18 10:04 gregorjovan

I am having Text column in Excel with numbers in it. "Number" in cca 280 row has value 3;4 and I am getting NUll. How someone can force data to be read as text/string not integers/numbers? Having column set to Text and numbers aligned to left does not solve my problem.

I have te same Problem!!

Oglaigh avatar Jun 08 '20 17:06 Oglaigh

i knocked into same problem. Any attributes to denote a type of column

JamesDeepakDass avatar Oct 22 '20 14:10 JamesDeepakDass

Me too

brazilkorea avatar Jul 02 '21 08:07 brazilkorea