473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

reading comma delimited files using VB.NET

How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.
Nov 22 '05 #1
7 11309
You would use a StreamReader to read the file line by line.
Then perform a .Split(@"\",\"") on the string.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"Ron McCafferty" <ro***********@community.nospam> wrote in message
news:AB**********************************@microsof t.com...
How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could
just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.

Nov 22 '05 #2
You would use a StreamReader to read the file line by line.
Then perform a .Split(@"\",\"") on the string.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"Ron McCafferty" <ro***********@community.nospam> wrote in message
news:AB**********************************@microsof t.com...
How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could
just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.

Nov 22 '05 #3
Try my parser, http://www.geocities.com/shriop/index.html

Robbe Morris [C# MVP] wrote:
You would use a StreamReader to read the file line by line.
Then perform a .Split(@"\",\"") on the string.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"Ron McCafferty" <ro***********@community.nospam> wrote in message
news:AB**********************************@microsof t.com...
How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could
just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.


Nov 22 '05 #4
Try my parser, http://www.geocities.com/shriop/index.html

Robbe Morris [C# MVP] wrote:
You would use a StreamReader to read the file line by line.
Then perform a .Split(@"\",\"") on the string.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"Ron McCafferty" <ro***********@community.nospam> wrote in message
news:AB**********************************@microsof t.com...
How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could
just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.


Nov 22 '05 #5
Ron,

Normally is used OleDb for that creating a dataset.

This is one of the messages where I have a sample about that.

http://groups-beta.google.com/group/...e1d7736d7f2a02

I hope this helps,

Cor
Nov 22 '05 #6
Ron,

Normally is used OleDb for that creating a dataset.

This is one of the messages where I have a sample about that.

http://groups-beta.google.com/group/...e1d7736d7f2a02

I hope this helps,

Cor
Nov 22 '05 #7
Robbe,

As I understand the split function wouldn't that split on every "?

For example "7 inches""" would return 7 inches and "" and not 7 inches"

Thanks,
Ron

"Robbe Morris [C# MVP]" wrote:
You would use a StreamReader to read the file line by line.
Then perform a .Split(@"\",\"") on the string.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"Ron McCafferty" <ro***********@community.nospam> wrote in message
news:AB**********************************@microsof t.com...
How do you read comma delimited data from programs such as Excel where the
data itself contains dounble quotes and commas. It used to be you could
just
use input. How is it fone now?

The data below contains output from Access saved as a CSV.
line 1,"normal data","a double quote "" here"
line 2,"a comma , here ","more normal data"

Input's help documents the "" will not work.


Nov 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ron McCafferty | last post by:
How do you read comma delimited data from programs such as Excel where the data itself contains dounble quotes and commas. It used to be you could just use input. How is it fone now? The data...
3
by: Elmo Watson | last post by:
I've been asked to develop a semi-automated type situation where we have a database table (sql server) and periodically, there will be a comma delimited file from which we need to import the data,...
1
by: John B. Lorenz | last post by:
I'm attempting to write an input routine that reads from a comma delimited file. I need to read in one record at a time, assign each field to a field array and then continue with my normal...
4
by: Hilary Cotter | last post by:
Thanks for all the help you gave me yesterday. here is another question. I have a comma delimited file called redirect.txt which looks like this test, /test.htm test 123,/test123.htm
3
by: Leonard Wright | last post by:
I'm developing a lottery program and want read a text file that has Draw date Draw number six lottery numbers all in comma delimited text file I want the user to select a draw number to show...
1
by: ungvichian | last post by:
So, right now I'm writing a program in VC++.Net with MFC, and one of the steps involves reading numeric values from a comma delimited file (like 4.56, 2.44, 3.453 etc.). The only methods I've been...
9
by: Bernie Yaeger | last post by:
Is there a way to convert or copy a .xml file to a comma delimited text file using vb .net? Thanks for any help. Bernie Yaeger
3
by: P K | last post by:
I read a CSV file using a stream reader. I read a complete line using readline. I need to get hold of each column. I can't use split function with a comma cos the contents in the columns might...
2
by: Wes Peters | last post by:
Does anyone know of an article that deals with the subject of reading a structured text file using VBA code in Access? Thanks, Wes
6
by: =?Utf-8?B?UmljaA==?= | last post by:
'--this code works but only reads text into one column when contains multiple cols Dim ds1x As New DataSet Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.