String ls_excelpath, docname
Integer li_rtn
Li_rtn = getfileopenname ("select file", ls_excelpath, docname, "xls", + "text files (*. XLS ),*. xls, "+" doc files (*. XLS ),*. xls ")
Oleobject oxls, osheet, obook
Integer ll_xls
Oxls = create oleobject
Ll_xls = oxls. connecttoobject ('', 'excel. application ')
Long ll_row, currow
Decimal ld_tmp
String ls_value
Currow = 1
// Set the data to be imported from the second row of Excel.
Obook = oxls. workbooks. Open (ls_excelpath)
Osheet = oxls. Sheets (1)
Do While true
Ls_value = string (osheet. cells (currow, 1). value)
// Read the Excel content and put it in the variable, cells (rows, columns)
If f_is_null (ls_value, "") = "" Then exit
// If empty, the import is complete.
Ll_row = dw_1.insertrow (0)
// Add rows to the data window
Dw_1.setitem (currow, "column name", string (ls_value ))
Currow ++
Loop
Obook. Close
Destroy osheet
Destroy obook
Destroy oxls
Return 0