Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel and CSV file
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01385124
Message ID:
01385387
Vues:
54
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform