Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel XLS/XLSX to CSV
Message
De
17/05/2016 10:46:45
 
 
À
17/05/2016 10:10:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
01636368
Message ID:
01636504
Vues:
51
>>>>Take a look at:
>>>>
>>>>http://vfpx.codeplex.com/wikipage?title=XLSXWorkbook&referringTitle=Home
>>>
>>>Greg, Antonio
>>>
>>>I have downloaded the class and I'm looking at the example form. I have looked through the documentation PDF file. But I cannot find how to Save an XLSX (or XLS) file previously opened into CSV format ? Any suggestions.
>>
>>Greg already gave you a suggestion on how to do it, but just remember that once you have XLSX data in a VFP table or cursor, the capacity of export it to CSV is native to VFP.
>>
>>Don't forget, also, that if the source file is in XLS format - that is, in the binary format that preceded XLSX - then VFP is able to natively support its ingestion.
>
>Thanks Antonio. I need to support both XLS and XLSX as I will not know what format is being sent. Users ... ! :)

By now, you already know that you must read them separately, but once they are in a table/cursor, they both can be handled in the same way. Something like this (no error handling or tidying up):
LOCAL lcFile AS String

DO CASE
CASE UPPER(JUSTEXT(m.lcFile)) == "XLSX"
	&& let's assume you defined a function that wraps the class instantiation and use
	ImportXLSXIntoACursor(m.lcFile)
CASE UPPER(JUSTEXT(m.lcFile)) == "XLS"
	IMPORT FROM (m.lcFile) TYPE XLS
OTHERWISE
	&& complain because not supported source format and return or whatever suits best
ENDCASE

COPY TO outputFileName.csv TYPE CSV
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform