READ_CSV: just one data field (=one column)? [message #85578] |
Mon, 19 August 2013 01:20  |
Therese
Messages: 5 Registered: May 2013
|
Junior Member |
|
|
Hello all,
I have a big problem with reading in a CSV file (comma delimited) created by Excel 2010. It contains various data (string, float, integer) in the columns and also has the column names in the first row.
My problem: READ_CSV read my *.csv but contains the whole row in one element of the result structure
Below I want to show you a minimum example with two columns of different data types and the column names "column1" and "column2"
XLSX-file:
column1 column2
row1 1
row2 2
row3 3
row4 4
CSV-file
column1;column2
row1;1
row2;2
row3;3
row4;4
for QUERY_CSV I get
IDL> test = QUERY_CSV(csvfile,info)
IDL> print,info
{ filepath*.csv CSV 5 1}
therefore, my resulting structure also contains just one field:
IDL> result = READ_CSV(csvfile, HEADER=head)
IDL> help,result
** Structure <27fbef0>, 1 tags, length=60, data length=60, refs=1:
FIELD1 STRING Array[5]
What am I doing wrong? Maybe, there is a problem in creating the CSV-file? Please help me!
Best regards,
Therese
|
|
|
|
Re: READ_CSV: just one data field (=one column)? [message #85580 is a reply to message #85579] |
Mon, 19 August 2013 02:38  |
Therese
Messages: 5 Registered: May 2013
|
Junior Member |
|
|
On Monday, August 19, 2013 10:43:21 AM UTC+2, Fabien wrote:
> Hi Therese,
>
>
>
> In your example it seems that your CSV-file is not comma-delimited but
>
> semicolon-delimited. You should tell Excel to use commas as separator,
>
> not semicolon.
>
>
>
> Cheers
Thank you, that's it!
|
|
|