Author | Topic: Set the first line without header in Odbc for Excel Files | |
---|---|---|
César Calvo | Set the first line without header in Odbc for Excel Files on Thu, 22 Jun 2017 22:01:48 +0200 I need read the first line of an Excel file since it isn´t a header, it is data. What must I change in this sorce? cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" oCon2 := SQLConnection():new() cSql2 := 'SELECT * FROM [Hoja1$];' IF !oCon2:driverConnect(nil,cCon2) Infobox("No conectado a " + cFil2) RETURN ENDIF oCur2 := SQLSelect():new(cSql2,oCon2) oCur2:execute() I have tried to change this: FirstRowHasNames=1 to this: FirstRowHasNames=0 But I don´t got it. Thanks. César. | |
Boris Borzic | Re: Set the first line without header in Odbc for Excel Files on Thu, 22 Jun 2017 22:51:18 +0200 Csar Calvo <ccalvoc@telefonica.net> wrote in news:645369be$5bb6387d$11370@news.alaska-software.com: > I need read the first line of an Excel file since it isnt a header, > it is data. > What must I change in this sorce? > cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, > *.xlsx, *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" > oCon2 := SQLConnection():new() > cSql2 := 'SELECT * FROM [Hoja1$];' > IF !oCon2:driverConnect(nil,cCon2) > Infobox("No conectado a " + cFil2) > RETURN > ENDIF > oCur2 := SQLSelect():new(cSql2,oCon2) > oCur2:execute() > > I have tried to change this: > FirstRowHasNames=1 > > to this: > FirstRowHasNames=0 > > But I dont got it. Looks like this is an old bug in the Excel ODBC driver that has never been fixed: https://social.msdn.microsoft.com/Forums/office/en-US/bdff0b5b-6838-4a4b- 9029-e1ba953824db/how-to-access-excel-files-using-odbc-without-skipping- first-row-with-access-2013-runtime?forum=adodotnetdataproviders Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools | |
Matej Jurac | Re: Set the first line without header in Odbc for Excel Files on Fri, 23 Jun 2017 09:05:55 +0200 Had same problem some years ago with xlsx without field headers. One of workarounds is by using Ascom10.lib to do an COM routine to read data from workbook. What you need is start here: https://msdn.microsoft.com/VBA/Excel-VBA/articles/application-object-excel look how to open table, change rows and active cells or by just nicely asking for table with header row Boris Borzic wrote in message news:XnsA79CAB6E936DASQLExpress@87.106.143.233... >Csar Calvo <ccalvoc@telefonica.net> wrote in >news:645369be$5bb6387d$11370@news.alaska-software.com: > >> I need read the first line of an Excel file since it isnt a header, >> it is data. >> What must I change in this sorce? >> cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, >> *.xlsx, *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" >> oCon2 := SQLConnection():new() >> cSql2 := 'SELECT * FROM [Hoja1$];' >> IF !oCon2:driverConnect(nil,cCon2) >> Infobox("No conectado a " + cFil2) >> RETURN >> ENDIF >> oCur2 := SQLSelect():new(cSql2,oCon2) >> oCur2:execute() >> >> I have tried to change this: >> FirstRowHasNames=1 >> >> to this: >> FirstRowHasNames=0 >> >> But I dont got it. > >Looks like this is an old bug in the Excel ODBC driver that has never been >fixed: > >https://social.msdn.microsoft.com/Forums/office/en-US/bdff0b5b-6838-4a4b- >9029-e1ba953824db/how-to-access-excel-files-using-odbc-without-skipping- >first-row-with-access-2013-runtime?forum=adodotnetdataproviders | |
César Calvo | Re: Set the first line without header in Odbc for Excel Files on Sun, 25 Jun 2017 21:09:51 +0200 Hello Boris, this page not exists. Regards. César. "Boris Borzic" escribió en el mensaje de noticias:XnsA79CAB6E936DASQLExpress@87.106.143.233... César Calvo <ccalvoc@telefonica.net> wrote in news:645369be$5bb6387d$11370@news.alaska-software.com: > I need read the first line of an Excel file since it isnït a header, > it is data. > What must I change in this sorce? > cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, > *.xlsx, *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" > oCon2 := SQLConnection():new() > cSql2 := 'SELECT * FROM [Hoja1$];' > IF !oCon2:driverConnect(nil,cCon2) > Infobox("No conectado a " + cFil2) > RETURN > ENDIF > oCur2 := SQLSelect():new(cSql2,oCon2) > oCur2:execute() > > I have tried to change this: > FirstRowHasNames=1 > > to this: > FirstRowHasNames=0 > > But I donït got it. Looks like this is an old bug in the Excel ODBC driver that has never been fixed: https://social.msdn.microsoft.com/Forums/office/en-US/bdff0b5b-6838-4a4b- 9029-e1ba953824db/how-to-access-excel-files-using-odbc-without-skipping- first-row-with-access-2013-runtime?forum=adodotnetdataproviders Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools | |
Boris Borzic | Re: Set the first line without header in Odbc for Excel Files on Mon, 26 Jun 2017 05:21:59 +0200 Csar Calvo <ccalvoc@telefonica.net> wrote in news:40ecc789$5d1a592a $2d25c@news.alaska-software.com: > Hello Boris, this page not exists. Yes, it does exist. You just need to copy and paste all 3 lines into your browser: https://social.msdn.microsoft.com/Forums/office/en-US/bdff0b5b-6838-4a4b- 9029-e1ba953824db/how-to-access-excel-files-using-odbc-without-skipping- first-row-with-access-2013-runtime?forum=adodotnetdataproviders Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools | |
César Calvo | Re: Set the first line without header in Odbc for Excel Files on Mon, 26 Jun 2017 06:25:48 +0200 Sorry, you are right. Thanks. "Boris Borzic" escribió en el mensaje de noticias:XnsA79FEDA568CE9SQLExpress@87.106.143.233... César Calvo <ccalvoc@telefonica.net> wrote in news:40ecc789$5d1a592a $2d25c@news.alaska-software.com: > Hello Boris, this page not exists. Yes, it does exist. You just need to copy and paste all 3 lines into your browser: https://social.msdn.microsoft.com/Forums/office/en-US/bdff0b5b-6838-4a4b- 9029-e1ba953824db/how-to-access-excel-files-using-odbc-without-skipping- first-row-with-access-2013-runtime?forum=adodotnetdataproviders Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools | |
Edgar Borger | Re: Set the first line without header in Odbc for Excel Files on Fri, 23 Jun 2017 11:03:33 -0300 with activex you get the whole spreadsheet, if you want I can give an example... Regards, Edgar Em 22/06/2017 17:01, César Calvo escreveu: > I need read the first line of an Excel file since it isn´t a header, it is data. > What must I change in this sorce? > cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" > oCon2 := SQLConnection():new() > cSql2 := 'SELECT * FROM [Hoja1$];' > IF !oCon2:driverConnect(nil,cCon2) > Infobox("No conectado a " + cFil2) > RETURN > ENDIF > oCur2 := SQLSelect():new(cSql2,oCon2) > oCur2:execute() > > I have tried to change this: > FirstRowHasNames=1 > > to this: > FirstRowHasNames=0 > > But I don´t got it. > > Thanks. > César. Edgar Borger Softsupply Informatica Ltda. Rua Alagoas, 48 Sao Paulo, SP 01242-000 Tel : (5511) 3159-1997 Email : softsupply@terra.com.br | |
César Calvo | Re: Set the first line without header in Odbc for Excel Files on Sun, 25 Jun 2017 21:12:42 +0200 Thanks Edgar. I would want with Odbc. Regards. César. "Edgar Borger" escribió en el mensaje de noticias:71573f35$4bce5228$1d70a@news.alaska-software.com... with activex you get the whole spreadsheet, if you want I can give an example... Regards, Edgar Em 22/06/2017 17:01, César Calvo escreveu: > I need read the first line of an Excel file since it isn´t a header, it is > data. > What must I change in this sorce? > cCon2 := "DBQ=" + cFil2 + ";Driver={Microsoft Excel Driver (*.xls, *.xlsx, > *.xlsm, *.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1" > oCon2 := SQLConnection():new() > cSql2 := 'SELECT * FROM [Hoja1$];' > IF !oCon2:driverConnect(nil,cCon2) > Infobox("No conectado a " + cFil2) > RETURN > ENDIF > oCur2 := SQLSelect():new(cSql2,oCon2) > oCur2:execute() > > I have tried to change this: > FirstRowHasNames=1 > > to this: > FirstRowHasNames=0 > > But I don´t got it. > > Thanks. > César. Edgar Borger Softsupply Informatica Ltda. Rua Alagoas, 48 Sao Paulo, SP 01242-000 Tel : (5511) 3159-1997 Email : softsupply@terra.com.br |