import from excel

how can i import an excel sheet with huge text on some cells... i try it, but the character field is only 254 chars size, i did try to create a table and then append the big text cells to memo fields, but they remain empty... thanks for the help !!


Answer this question

import from excel

  • leeast

    Instead of import use SPT to get the data.
  • Ryan Paul

    I'll try, Thanks !!



  • Wendell G

    I believe you'll need to use automation to do this manually transferring the contents of the cells to your table's memo fields.

  • Bert from E.care

    I wrote this a while ago to convert an excel file to a foxpro dbf... its need some cleaning up but it should give you a good start.

    Dave

    *
    * FNXLSTODBF
    *
    **
    *FUNCTION TO CONVERT AND XLS TO DBF
    *FNXLSTODBF('FILE.XLS','FILE.DBF')
    *MXLSFILE TO CONVERT
    *MDBFFILE TO CREATE

    LPARAMETERS MXLSFILE,MDBFFILE
    IF VARTYPE(MXLSFILE)<>'C'
    RETURN .F.
    ENDIF
    IF VARTYPE(MDBFFILE)<>'C'
    RETURN .F.
    ENDIF
    IF EMPTY(MXLSFILE) OR EMPTY(MDBFFILE)
    RETURN .F.
    ENDIF
    xlDBF4=11
    IF FILE(MDBFFILE)
    DELETE FILE &MDBFFILE
    ENDIF
    * Create the Excel App Object
    xlApp = CreateObject("Excel.Application")
    * Create the Excel Workbook Object.
    xlBook = xlApp.Workbooks.Open(MXLSFILE)
    xlBook.worksheets[1].RANGE("A1").Select
    *** SAVE AS DB4
    xlBook.Saveas(MDBFFILE,xlDBF4)
    ********************************
    xlBook.Close(.F.)
    xlApp.QUIT
    RELEASE xlBook
    RELEASE xlApp

    ****** convert to current ver of foxpro
    SELECT 0
    USE &MDBFFILE
    mfile1=ALIAS()
    MDBFFILE2=MDBFFILE+'1'
    SELECT * from &MDBFFILE INTO TABLE &MDBFFILE2
    mfile2=ALIAS()

    SELECT &mfile1
    USE

    SELECT &mfile2
    COPY TO &MDBFFILE
    USE
    DELETE FILE &MDBFFILE2

    RETURN .T.


  • disom6162

    I take it back.. your big text will still get cut... it looks like its an excel export issue.

    Craig Boyd is right you will have to manually pull the data out of excel with office automation.

    Sorry..

    dave


  • AndyP

    I'm a novice, could you be more specific

    Thanks.



  • &amp;#193;ron Kolozs

    Cetin says to use SPT... why I never thought to do this is beyond me. (Probably because I associate (wrongly) SPT with relational databases

    Here you go :

    MCONNSTR="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\FOX\TEST.xls;DefaultDir=c:\FOX;"

     nConn = sqlstringconnect(MCONNSTR)
    sqlexec(nconn, "select * from [sheet1$]", "CRSXLS")

    SELECT CRSXLS
    BROW

    Real Simple.
    Dave



  • SuperNova

    i'm checking that... Thanks a lot !



  • import from excel