Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing CSV Files?
Message
 
To
06/07/2004 13:36:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00921099
Message ID:
00921103
Views:
16
Hi, Tom. You may put all of this in the category of "well, gee, I already knew that much" :) but here goes. Seems to me that you'd need to use LLFF to read a line and parse for commas (ALINES should work well for that). Then for each element, you could do additional parsing to come up with at least a default data type (e.g. - roughly, " indicates C or M, . indicates N, 2x / or - indicates date, unless also : which indicates datetime, none of the above but all digits indicates I). Of course, you really need to read the entire file, so that you can then determine the max-allowed length of each column.

Seems to me that you may be able to use the code for the VFP import wizard as a shortcut. You should find a file named xsource.zip in your HOME() + 'TOOLS\XSOURCE' folder. In the ZIP file, look for files in the path "VFPSource\Wizards\wzimport."

Kelly

>I need to write a generic program that can examine the structure of a comma seperated file. Once the structure of the has been determined, I will do an APPEND FROM into the cursor that will be created from the first step.
>
>The question is what is the best technique to determine the structure of any CSV file and create a cursor based on that structure for any file that is thrown at the generic import program?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform