>I need to import from excel files with a column of dates stored in dd/mm/yyyy format. Unfortunately the first row of cells in each file holds the heading for the columns. If I remove the heading cells from my test spreadsheet it imports fine. If they're left in the date column is imported to a 9 character string field and I loose the last digit of each date.
>
>I think I need to create an excel object and then somehow read in values from the the header cells before deleting them so that dates will import properly.
>
>I'm new to all this though and I'm stuck again. Any help would be greatly appreciated.
>
>Phil.
Phil,
You have multipl options :) But IMHO this one is the easiest :
#DEFINE xlCSV 6
#DEFINE xlDBF3 8
#DEFINE xlExcel5 39
lcXLSFile = 'yourXLSFullPathHereIncludingXLS'
lcDBFFile = 'yourDBFNameHere'
oExcel = createobject('Excel.Application')
with oExcel
.Workbooks.Open(lcXLSFile)
.ActiveWorkBook.SaveAs(lcDBFFile, xlDBF3)
.ActiveWorkbook.Saved = .t.
.Quit
endwith
use (lcDBFFile)
brow
PS: lcDBFFile is NOT an existing .dbf file. Otherwise you should control overwriting and in use (for Excel side .DisplayAlerts = .f. - no overwrite).
Cetin