Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append From (spreadsheet): column names?
Message
De
10/07/2006 05:59:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
09/07/2006 09:52:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01134756
Message ID:
01134870
Vues:
26
>If you export to a spreadsheet using the command:
>
>EXPORT TO MySpreadsheet TYPE XLS (or some other spreadsheet type)
>
>and then later, in another program, you import data from that same spreadsheet into a cursor using the statement:
>
>APPEND FROM MySpreadsheet TYPE XLS (or some other spreadsheet type)
>
>is there any way to get the column names from the spreadsheet that that were created in the first step when the spreadsheet was created?
>
>I know that for character columns, the column name appears in the first row, but all numeric columns appear as 0. Is there some way to query the spreadsheet to determine the column names?
>
>I need to to do this in order to check if the user imported an incorrect spreadsheet (which I would know because the spreadsheet would not have the correct columns) or if the user moved the columns around between the time the spreadsheet was created and the time it was re-imported.
>
>TIA

Chaim,
For export use type XL5 instead.
Then you can use SPT to get the data into a temp cursor. ie:
use customer
Export to xxCustomer.xls type xl5
use
lcXLS = Sys(5)+Curdir()+'xxCustomer.xls'
lcConn = "Driver={Microsoft Excel Driver (*.xls)};"+;
  "DriverId=790;Dbq="+m.lcXLS+;
  ";DefaultDir="+JustPath(m.lcXLS)+";" 
lnHandle = SQLStringConnect(m.lcConn) 
SQLTables(m.lnHandle,"", "SheetNames")
Scan
  lcTableName = Trim(SheetNames.Table_Name)
  lcOutput = Chrtran(m.lcTableName,' $','_')
  SQLExec(m.lnHandle,'select * from ['+m.lcTableName+']',m.lcOutput )
endscan
SQLDisconnect(m.lnHandle)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform