473,830 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2021
On Mon, 11 Aug 2008 13:49:19 +0200, "Tony Johansson"
<jo************ *****@telia.com wrote:
>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.ande rs...@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.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.
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.e du.slash.mcwrot e in message
news:#M******** ******@TK2MSFTN GP02.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

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

Similar topics

1
3408
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 logs2.csv logs... The number of file is variable but the internal format is always : time_sec;level So the files content a field that may be used as unique key in the target database.
13
2345
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. Although I'm proud of having tackled the problem and produced code that works I worry that I could have saved a lot of time if I could have just found that class in the library which I'm convinced must work. Does anyone have an explanation as to...
3
2623
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 = "Select * from ";
25
12768
by: Ali-R | last post by:
Hi, Is there a parser which parses CSV files? Thanks for your help. Reza
3
15791
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 fine, but receive errors when I change it to link CSVs. Sub mcrAllPermut_LinkExternalTables() Set db = CurrentDb strDir = "C:\"
3
8828
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 change name each month. Each file contains 13 columns and around 20k rows. In each file, the first row is the heading. I have created a database that helps me sort out the data. Prior to importing into the database, I have been copying the csv...
12
11108
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 data, I just don’t want folks to peek in the files. So time-consuming encryption is not necessary, just a simple password-to-open that I can program in my application so it internally opens the imported CSV file would be perfect, but I can’t...
7
2500
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
2270
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 get hold of the data and crunch it. How do I do this ? (or alternatively download the csv file which is pointed to by a hyperlink).
0
9781
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9641
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10769
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10477
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10197
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7740
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3956
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.