Page 1 of 1

GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 7:42 am
by Silvio.Falconi
Making this sample test I can show any datas, where is the error ?

Code: Select all  Expand view
#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

Image

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 10:58 am
by nageswaragunupudi
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.

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 2:22 pm
by Silvio.Falconi
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

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 2:51 pm
by Marc Venken
Your sample is working here. Just a local file from myself in de exe folder. rest is the same

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 2:54 pm
by Marc Venken
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..

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 7:48 pm
by Silvio.Falconi
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..





Image


Can I send you a small test ? my mail is silvio_dot_falconi_at_gmail_dot_com

Re: GetExcelRange ERROR

PostPosted: Fri Sep 17, 2021 9:25 pm
by nageswaragunupudi
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 )

Re: GetExcelRange ERROR

PostPosted: Sat Sep 18, 2021 6:44 am
by Silvio.Falconi
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?

Re: GetExcelRange ERROR

PostPosted: Mon Sep 20, 2021 4:42 am
by anserkk
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

Re: GetExcelRange ERROR

PostPosted: Mon Sep 20, 2021 5:16 am
by nageswaragunupudi
Yes, Thanks Mr. Anser
FWH has function for reading Excel with ADO
Code: Select all  Expand view

oRs := FW_OpenADOExcelSheet( cFile, [cSheet], [cRange], [lHeaders] )
XBROWSER oRs
 

Re: GetExcelRange ERROR

PostPosted: Mon Sep 20, 2021 8:04 am
by Silvio.Falconi
nageswaragunupudi wrote:Yes, Thanks Mr. Anser
FWH has function for reading Excel with ADO
Code: Select all  Expand view

oRs := FW_OpenADOExcelSheet( cFile, [cSheet], [cRange], [lHeaders] )
XBROWSER oRs
 


thanks Mr Nages,
I tried with
Code: Select all  Expand view
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?