Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating table from CSV
Message
From
06/11/2016 06:20:01
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01642781
Message ID:
01642796
Views:
38
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform