This can also be written as:leandro wrote:Amigo puedes hacerlo directamente desde Excel, esta función convierte el Excel a un array de tipo hash
Code: Select all | Expand
Function recupera(cRtaXls) Local hLinea := {=>} Local aDatos := {} Local oExcel,oBook,oHoja Local nTotRowCount := 0 Local nTotColCount := 0 Local nContador := 1 oExcel:= TOleAuto():New("Excel.Application") oBook := oExcel:Workbooks:Open(cRtaXls) oHoja := oExcel:Get( "ActiveSheet" ) nTotRowCount:= oHoja:UsedRange:Rows:Count() nTotColCount:= oHoja:UsedRange:Columns:Count() //oMeter:nTotal = nTotRowCount //oMeter:Set( 0 ) FOR Q=1 TO nTotRowCount FOR b:=1 TO nTotColCount cNmcol := "COL"+cvaltochar(b) hLinea[cNmcol] := oHoja:Cells( Q, b ):Value NEXT AADD(aDatos,hLinea) hLinea := {=>} nContador++ //oMeter:Set( nContador ) NEXT oExcel:WorkBooks:Close() oExcel:Application:Quit() oExcel:Quit() oExcel := NIL xbrowse(aDatos) Return nil
Code: Select all | Expand
oRange := GetExcelRange( cExelFileWithFullPath )
aData := xlRangeValue( oRange )
XBROWSER aData