473,387 Members | 1,745 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,387 software developers and data experts.

CSV(comma separated values) files

Hello!

What does it mean when it says that there is no information about the data
types of the data extracted from a CSV file.

Can somebody this.

//Tony
Aug 11 '08 #1
10 1982
On Mon, 11 Aug 2008 13:49:19 +0200, "Tony Johansson"
<jo*****************@telia.comwrote:
>Hello!

What does it mean when it says that there is no information about the data
types of the data extracted from a CSV file.

Can somebody this.

//Tony
Take a simple example, a CSV file containing "123". You cannot tell
from the CSV file alone whether this is the integer 123, the double
123.0, the string "123" or the character array {'1', '2', '3'}.

When you convert some data into a string for a CSV file much of the
type information is lost.

HTH

rossum

Aug 11 '08 #2
On Aug 11, 12:49*pm, "Tony Johansson" <johansson.anders...@telia.com>
wrote:
What does it mean when it says that there is no information about the data
types of the data extracted from a CSV file.
It would help if you'd clarify what "it" is here.

Jon
Aug 11 '08 #3
Tony Johansson wrote:
What does it mean when it says that there is no information about the data
types of the data extracted from a CSV file.
The CSV does not contain information about the data type of each column.

It will be a guess based on the values.

Arne
Aug 12 '08 #4
rossum wrote:
On Mon, 11 Aug 2008 13:49:19 +0200, "Tony Johansson"
<jo*****************@telia.comwrote:
>What does it mean when it says that there is no information about the data
types of the data extracted from a CSV file.
Take a simple example, a CSV file containing "123". You cannot tell
from the CSV file alone whether this is the integer 123, the double
123.0, the string "123" or the character array {'1', '2', '3'}.
Strings are usually quoted and arrays not used in CSV, so some
types can be ruled out.

Arne
Aug 12 '08 #5
MC
Strings are usually quoted and arrays not used in CSV, so some
types can be ruled out.
Speaking of which, is there an "official syntax" for CSV files somewhere,
and/or a C# tool to parse them?
Aug 12 '08 #6
http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm shows the rules for
csv file creation. There are no standard c# tools that I know of to
parse them, but the Code Project has a few public projects which will do
this for you or point you in the right direction to roll your own.

It's fairly easy to parse them by using the string.split functionality
of c#. I have a number of samples if you need some help.


"MC" <fo**************@www.ai.uga.edu.slash.mcwrote in message
news:#M**************@TK2MSFTNGP02.phx.gbl:
Strings are usually quoted and arrays not used in CSV, so some
types can be ruled out.

Speaking of which, is there an "official syntax" for CSV files somewhere,
and/or a C# tool to parse them?
Aug 12 '08 #7
MC wrote:
>Strings are usually quoted and arrays not used in CSV, so some
types can be ruled out.

Speaking of which, is there an "official syntax" for CSV files somewhere,
and/or a C# tool to parse them?
I don't think there is a general definition.

But most programmers have an idea about what it is.

Export/import from/to Access shows some of the options.

The most common format is:
- comma between fields
- double quotes around text
- double quotes within text doubled
- one record per line

There actually is a standard:

http://tools.ietf.org/html/rfc4180

but it i snot my impression that it is widely used
as a reference.

Arne
Aug 12 '08 #8
On Mon, 11 Aug 2008 21:52:20 -0400, MC wrote:
>Strings are usually quoted and arrays not used in CSV, so some types
can be ruled out.

Speaking of which, is there an "official syntax" for CSV files
somewhere, and/or a C# tool to parse them?
I would strongly recommend that you don't use CSV at all. I believe that
CSV is the worst possible method of delivering data. I am aware of Excel
exporting data to CSV that imported differently.

Different programs do that handle Quotes properly for example 'O'Donnell'
should be 'O''Donnell'. If you have quote comma you are totally lost
'1 degree 0', something' A parser would take that as two fields, but is
it extracted as :1 degree 0:, :something': or as :something:. You can
never tell.

Ken

Ken
Aug 12 '08 #9
Ken Foskey wrote:
I would strongly recommend that you don't use CSV at all. I believe that
CSV is the worst possible method of delivering data.
The format has worked for a few decades. It can not be completely
hopeless. Usually the developers get it working.

I would also prefer XML as format, if starting white a blank
piece of paper. But that is often not the case. There are
lots of software out there that uses CSV.

Arne
Aug 12 '08 #10

eg:
"uma","devi"
how can i get only strings without quotes and comma using c#

*** Sent via Developersdex http://www.developersdex.com ***
Sep 24 '08 #11

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

Similar topics

1
by: Laurent | last post by:
Hi all, I have de following application to do : I receive several .csv files from another application in a determined folder of my PC. Those files are named with the format log1.csv...
13
by: Cat | last post by:
I don't understand why there's no class included in the libraries for reading CSV files.. I've created my own CSV reader class which reads a CSV file, generates a report and returns records etc....
3
by: James | last post by:
Hi, I'm importing some csv files with this code /// start of code snippet int iPos = strFileName.LastIndexOf(@"\"); string strPath = strFileName.Substring(0,iPos); string strSelect =...
25
by: Ali-R | last post by:
Hi, Is there a parser which parses CSV files? Thanks for your help. Reza
3
by: Butaambala | last post by:
Hello, I am attempting to write a procedure that will loop through a directory of CSV files, linking each of them to a database. I have tested the following code for XLS files, and it works...
3
by: ninrulz | last post by:
I will try to explain my situation. I know that it is hard to offers solutions without fully understanding what people would like to achieve. I receive 2 csv files every month. The csv files...
12
by: =?Utf-8?B?am9uaWdy?= | last post by:
I wrote a simple VB.NET application that imports and edits CSV files. Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be opened separately. It is not high-sensitive...
7
by: johnny | last post by:
Any Good tools to create CSV Files? ReportLab only creates pdf files. I need something to create CSV files. Thank you.
4
by: Ian Semmel | last post by:
If I navigate to say http://Site/filename.csv, the web browser control or IE displays an excel sheet with the data in it. (Safari displays the raw text). This is not what I want. I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.