Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading from .csv files #49

Closed
nitewulf opened this issue Jul 25, 2014 · 5 comments
Closed

Reading from .csv files #49

nitewulf opened this issue Jul 25, 2014 · 5 comments

Comments

@nitewulf
Copy link

I'm trying to query a .csv file generated from an external system and some example data looks like:

"1230200",,"01","UST, LTD"

They system is putting quotes around fields that don't need them. That is causing LinqToExcel to treat those fields as arrays. I'm having to open the .csv files with excel and save them again as a .csv file to remove the unnecessary quotes so the line would look like:

1230200,,1,"UST, LTD"

which LinqToExcel reads happily.

Are there any configuration options that i'm missing to have LinqToExcel read my files correctly?

@paulyoder
Copy link
Owner

Sorry, I don't know of any configuration options that can be set. LinqToExcel uses OLEDB to read from the csv file, so I recommend searching for any configuration options available. And if you find one, let me know.

@nitewulf
Copy link
Author

Found one.

I resurrected some old code I wrote using

http://msdn.microsoft.com/en-us/library/ms974559.aspx

I found that if I generated my schema.ini file using Format=Delimited (,) instead of Format=CSVDelimited OLEDB was able to read the .csv file without any issues.

From: Paul Yoder [mailto:notifications@github.com]
Sent: Friday, July 25, 2014 2:57 PM
To: paulyoder/LinqToExcel
Cc: nitewulf
Subject: Re: [LinqToExcel] Reading from .csv files (#49)

Sorry, I don't know of any configuration options that can be set. LinqToExcel uses OLEDB to read from the csv file, so I recommend searching for any configuration options available. And if you find one, let me know.


Reply to this email directly or view it on GitHub #49 (comment) . https://github.com/notifications/beacon/8270448__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyMTkzNzQyNiwiZGF0YSI6eyJpZCI6MzgwMTM0MzF9fQ==--bc7d557626a77eaaaf90317b7f754106bc1530b8.gif

@paulyoder
Copy link
Owner

So it's working fine for you now?

@nitewulf
Copy link
Author

sigh. No, it looks like I ran a test with the wrong file. I thought I had found a configuration option for OleDb to read my “special” .csv file. If I figure out some way to get OleDb to read the file I’ll let you know.

From: Paul Yoder [mailto:notifications@github.com]
Sent: Friday, July 25, 2014 4:22 PM
To: paulyoder/LinqToExcel
Cc: nitewulf
Subject: Re: [LinqToExcel] Reading from .csv files (#49)

So it's working fine for you now?


Reply to this email directly or view it on GitHub #49 (comment) . https://github.com/notifications/beacon/8270448__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyMTk0MjUzNCwiZGF0YSI6eyJpZCI6MzgwMTM0MzF9fQ==--cdd997a61dc68f92ffb4c8ba474af3d75e75c0c7.gif

@usmanbinasif
Copy link

Hi,

Facing the same issue, is anyone found how to fix this ???

Regards,
UJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants