Importar datos

Que tal, alguna idea de, como pasar datos que están en un archivo exel pasarlos a una tabla de vfp, gracias

1 Respuesta

Respuesta
1
Claro en el foxpro te vas al menu Archivo importar elijes el formato de archivo que quieres importar y ya. Ten encuienta que el archivoi de excel debe tener formato 5 o 97 para que sea compatible.
Y por medio, de programar para que sea automatizado, y en los archivos .txt como seria también porfas
Gracias
Ups mas complicado por q tendrias q abrir el archivo excel en un objeto y q por cierto siempre tendra q tener el mismo formato y hacer la caraga a una tabla tambien tendras q indicar cuantas lineas vas a caragar un poquito largo el proceso te paso algo de codigo haber si le entiendes.
Abrirtabla('productos')
uni=SYS(5)
camin='\viauno\muestra'
loExcel=Createobject("Excel.application")
loExcel.Visible = .F.
loBook = loExcel.Workbooks.Open( uni+camin)
lohoja1 = loBook.Sheets['inventario']
lohoja1.activate
FOR linea=2 TO 6152
   WITH lobook.ActiveSheet
       SELECT productos
       SET ORDER TO codi_pro
       seek .Range('A'+alltrim(str(linea))).Value
       IF FOUND()
         REPLACE cantidad WITH cantidad+1
       ELSE
        *IF .Range('A'+alltrim(str(linea))).Value >9999999
         APPEND BLANK
         *MESSAGEBOX(.Range('A'+alltrim(str(linea))))
         REPLACE codi_pro WITH .Range('A'+alltrim(str(linea))).Value
         REPLACE cantidad WITH 1
         REPLACE material WITH .Range('D'+alltrim(str(linea))).Value
         REPLACE talla WITH .Range('B'+alltrim(str(linea))).Value
         ct=.Range('C'+alltrim(str(linea))).Value
         IF TYPE('ct')='N'
               REPLACE modelo WITH ALLTRIM(STR(ct))
         ELSE
               REPLACE modelo WITH ALLTRIM(ct)
         ENDIF      
         REPLACE marca WITH .Range('G'+alltrim(str(linea))).Value
         REPLACE color WITH .Range('E'+alltrim(str(linea))).Value
         REPLACE tipo WITH .Range('F'+alltrim(str(linea))).Value
         REPLACE descrip WITH ALLTRIM(marca)+' '+ALLTRIM(modelo)+' '+ALLTRIM(tipo)+' '+ALLTRIM(STR(talla))+' '+ALLTRIM(material)+' '+ALLTRIM(color)
         REPLACE porcen WITH .Range('I'+alltrim(str(linea))).Value
         IF linea>4593
          IF INT(.Range('J'+alltrim(str(linea))).Value)=.Range('J'+alltrim(str(linea))).Value
             PRE=.Range('J'+alltrim(str(linea))).Value
          ELSE
           PRE=INT(.Range('J'+alltrim(str(linea))).Value)+1
          ENDIF   
         ELSE
            pre=.Range('J'+alltrim(str(linea))).Value
         ENDIF
         REPLACE precio WITH PRE
         REPLACE por1 WITH .Range('K'+alltrim(str(linea))).Value
         REPLACE precio_com WITH .Range('H'+alltrim(str(linea))).Value
        *ENDIF
       ENDIF   
   ENDWITH
NEXT linea
loBook = loExcel.Workbooks.CLOSE
*_Screen.LockScreen= .F.
RELEASE loExcel
Cerrartabla('productos')
Release thisform

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas