Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating table from CSV
Message
De
06/11/2016 06:20:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01642781
Message ID:
01642796
Vues:
39
>Thanks Antonio, good suggestions and I will work through this.
>
>>>I need to create a table from a CSV (which comes from PayPal, Bank, etc.).
>>>
>>>Anyone having any suggestions on the best way to do this? Just appending the CSV into an existing table does not give me a list of the column names found in the CSV.
>>
>>It's interesting that VFP has no support for programmatically IMPORT from CSV, when it is capable of import from more complex file formats.
>>
>>Anyway, one idea is to read the file and process it as an XML tree and let XMLTOCURSOR() do the dirty work. A basic implementation of this idea (no proper error handling, no great robustness) goes as follows:
>>

I noticed some problems with quoted content parsing, but that is easily solved...

What I like most about this process is that you can benefit from all XMLTOCURSOR() intelligence regarding field data types assignment: char, memo, numeric, logical, they are all auto-detected in the best way that VFP is capable.
----------------------------------
António Tavares Lopes
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform