Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy To CSV and Field With Quotes and Commas
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01392202
Message ID:
01392252
Views:
96
This message has been marked as the solution to the initial question of the thread.
You have to double double-quotes before copy to csv file
...
UPDATE c_test SET textfld1  = STRTRAN(textfld1, ["], [""])
COPY TO myfile.csv TYPE CSV 
Or you may consider alternative way of importing VFP data into Excel as in Can somebody please give a hand? Message #1386305

>If you use the copy to csv command with a cursor that has a text field that has quotations and commas, you can end up with a csv file that cannot be opened by Excel properly.
>
>
>create cursor c_test (textfld1 C(50), numfld1 N(10,2))
>
>insert into c_test (textfld1,numfld1) values ('test test',12345.67)
>insert into c_test (textfld1,numfld1) values ('test 9", test 10", test',12345.67)
>insert into c_test (textfld1,numfld1) values ('test test',12345.67)
>
>
>COPY TO c:\foxpro\myfile.csv TYPE CSV 
>
>
>You see how that second row will take 4 columns to display in Excel instead of just 2 columns like it should?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform