Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel and CSV file
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01385124
Message ID:
01385387
Views:
55
>>I have some code that saves an Excel file as a CSV file
>>
oExcel.ActiveWorkbook.SaveAs(cDestinXLS ,6)
>>
>>Normally the CSV file looks like this:
>>
>>
ACC1, 1000000.00, Revenue
>>
>>However, if the user formats the amount in Excel to have commas for thousands, then the CSV file looks like this:
>>
>>
ACC1, "1,000,000.00", Revenue
>>
>>
>>This causes problems later when I import the CSV file:
>>
Append From (impfile) Type Delimited
>>The amount 1000000.00 gets imported as 1 i.e. it stops at the first comma.
>>
>>
>>Perhaps I should find a way to remove the commas from any amounts before saving the Excel file as a CSV file. Do you know how to do that?
>>
>>
>>Cyril
>
>Try with intermediate cursor
>
>CREATE CURSOR crsTest (Fld1 CHAR(30),Amount Char(15), Fld2 CHAR(30))
>Append From (impfile) Type Delimited
>REPLACE Amount WITH CHRTRAN(Amount,[,],[]) ALL
>
>SELECT YourFile
>APPEND FROM DBF([crsTest])
>
Thanks for the suggestion.

Cyril
Previous
Reply
Map
View

Click here to load this message in the networking platform