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 !!
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
import from excel
leeast
Ryan Paul
I'll try, Thanks !!
Wendell G
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.
&#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 !