FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetExcelRange ERROR
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
GetExcelRange ERROR
Posted: Fri Sep 17, 2021 07:42 AM
Making this sample test I can show any datas, where is the error ?

Code (fw): Select all Collapse
#include "FiveWin.ch"

Function test()
local cFileXls:="orario.xlsx"
Local oRange,lOpened:=.f.

oRange := GetExcelRange(cFileXls , , @lOpened)

xbrowser oRange

return nil


I check the file with Google Excel and I see there datas as you can see here

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 10:58 AM

GetExcelRange() can not open xls file, if it is already opened by any application other than Microsoft Excel.
Close Google Sheets and try.
Also give full path.

Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 02:22 PM
nageswaragunupudi wrote:GetExcelRange() can not open xls file, if it is already opened by any application other than Microsoft Excel.
Close Google Sheets and try.
Also give full path.



please I not open the xls file with another app
please do you see my test sample ?
the file orario.xlsx is on the root of exe
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 02:51 PM

Your sample is working here. Just a local file from myself in de exe folder. rest is the same

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 02:54 PM

Silvio, keep in mind that the sample is not killing the object, so exel is still in the taskbar. See into it...

Maybe that is a issue at your site..

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 07:48 PM
Marc Venken wrote:Silvio, keep in mind that the sample is not killing the object, so exel is still in the taskbar. See into it...

Maybe that is a issue at your site..








Can I send you a small test ? my mail is silvio_dot_falconi_at_gmail_dot_com
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: GetExcelRange ERROR
Posted: Fri Sep 17, 2021 09:25 PM

1) Is Microsoft Excel installed on this computer?
Check:
if ExcelObj() == nil
? "Not installed"
else
? "Installed"
endif

2) Also check if file exists with
? File( cFileXls )

Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: GetExcelRange ERROR
Posted: Sat Sep 18, 2021 06:44 AM
nageswaragunupudi wrote:1) Is Microsoft Excel installed on this computer?
Check:
if ExcelObj() == nil
? "Not installed"
else
? "Installed"
endif

2) Also check if file exists with
? File( cFileXls )


Sorry Nages,

one question: maybe the problem is that there is no Excel on that computer?

No there is no Excel, discovered the mystery ....

and I was convinced that it could work even without excel

Is there no remote possibility of extracting data from an excel spreadsheet without having Microsoft Excel installed?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: GetExcelRange ERROR
Posted: Mon Sep 20, 2021 04:42 AM
Silvio.Falconi wrote:Is there no remote possibility of extracting data from an excel spreadsheet without having Microsoft Excel installed?

You can use ADO to read the Excel data without having Excel installed on your PC
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: GetExcelRange ERROR
Posted: Mon Sep 20, 2021 05:16 AM
Yes, Thanks Mr. Anser
FWH has function for reading Excel with ADO
Code (fw): Select all Collapse
oRs := FW_OpenADOExcelSheet( cFile, [cSheet], [cRange], [lHeaders] )
XBROWSER oRs
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: GetExcelRange ERROR
Posted: Mon Sep 20, 2021 08:04 AM
nageswaragunupudi wrote:Yes, Thanks Mr. Anser
FWH has function for reading Excel with ADO
Code (fw): Select all Collapse
oRs := FW_OpenADOExcelSheet( cFile, [cSheet], [cRange], [lHeaders] )
XBROWSER oRs


thanks Mr Nages,
I tried with
Code (fw): Select all Collapse
oRange := FW_OpenADOExcelSheet(cFileXls)
xbrowser oRange


Give me first this Message "ADO ERROR UKNOWN"
and then "fail to open "C:\work\errori\getexelrange\orario.xls"


I think I must install Microsoft.ACE.OLEDB from https://www.microsoft.com/it-it/download/details.aspx?id=13255

another question
I mustuse it on Tables with windows 10 Pro, I would have preferred not to install a lot of software to make the system more free Office would be a bit heavy
If I would install OpenOffice which is free, what function can I use?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion