>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