leora
leora

Reputation: 196741

whats the best way to read a csv file from a url in C#

i have a url when i click on it i get windows asking me what to open it in and it recommends excel.

I now want to read this csv data dynamically in a c# application. what is the best way of getting csv data from Http Request to a url?

Upvotes: 0

Views: 1249

Answers (2)

casperOne
casperOne

Reputation: 74560

Once you get the data you can save it on the local drive. From there, you should be able to use the Jet provider for OLEDB in .NET to read the CSV file. The connection string will look something like this:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;Extended
Properties=""text;HDR=Yes;FMT=Delimited"""

Upvotes: 0

Tim Robinson
Tim Robinson

Reputation: 54764

For HTTP, use either the WebClient or WebRequest/WebResponse classes.

For parsing the CSV file itself, these suggestions should help.

Upvotes: 2

Related Questions