Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import CSV with data contain comma
Message
De
01/10/2015 03:13:45
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
01/10/2015 03:10:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
SAMBA Server
Database:
MySQL
Application:
Desktop
Divers
Thread ID:
01625282
Message ID:
01625290
Vues:
45
>>>>g'day
>>>>
>>>>Because I like to retain 1st row of csv file, I using the common
>>>>
>>>>APPEND FROM (mGetFile) TYPE DELIMITED WITH ","
>>>>
>>>>rather then
>>>>
>>>>APPEND FROM (mGetFile) TYPE CSV
>>>>
>>>>But with this method if data column contain common, VFP will slit the data into 2 column,
>>>>
>>>>eg
>>>>cusno,itemNo,model,qty
>>>>LD50,18340,LD90T0RELK,100
>>>>LD80,18340,"LD80,T0RELK",200
>>>>
>>>>the 3th row of data will have 1 extra column.
>>>
>>>APPEND FROM (mGetFile)  TYPE DELIMITED
>>>
>>in adddition
>>
>>
>>APPEND FROM (mGetFile)  TYPE DELIMITED FOR !nameoffirstcolum=="cusno"
>>
>>
>>Problem was to remove first row ...
>>
>>update:
>>
>>possibly
>>
>>FOR !TRIM(nameoffirstcolum)=="cusno"
>>
>>because this is not a SQL command
>
>If I have to process a file that has column names as the first row, I usually strip that row out with FILETOSTR/STRTOFILE. So in this case I was only concerned about the data rows.
>
>Using TYPE CSV ignores the first row but ISTR running into problems with files that didn't always quote strings etc. There seem to be lots of different interpretations of the CSV "standard" :(

We don't like to made the things complicated to the OP, don't we?
I just read the whole thing plain and process through SQL.

CSV is a good example of standard ;)
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform