Solved

Excel as Database connection lost Error

  • 29 December 2022
  • 9 replies
  • 576 views

Badge +5

Hi Guys,

 

While running the code in a production server (unattended mode), I am getting an error when it is trying to run a basic select query in an excel and getting an error as below :

 

The connection for viewing your linked Microsoft Excel worksheet was lost.

 

I am getting this error on the exact same line where the select query is written and I was not getting this kind of error before (not even once!) . Surprisingly when I log in to the VM & run the code again, it runs fine.

 

Any suggestions or resolutions please ?

icon

Best answer by Padmakumar 29 December 2022, 12:02

View original

9 replies

Userlevel 7
Badge +13

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Badge +5

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Only in that particular I am using excel as database & getting an error for the past couple of run

Userlevel 7
Badge +13

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Only in that particular I am using excel as database & getting an error for the past couple of run

 

If that’s the case then, try to change the Database Package version and check.

Badge +5

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Only in that particular I am using excel as database & getting an error for the past couple of run

 

If that’s the case then, try to change the Database Package version and check.

Thanks for the suggestion, will let you the results post today’s run

Userlevel 5
Badge +10

 

@Abhi25 : will you be able to establish ODBC Excel Driver successfully ?

 

[Microsoft][ODBC Excel Driver] The connection for viewing your linked Microsoft Excel worksheet was lost.

Troubleshooting

 

Problem

I am trying to open an Excel file in Statistics using ODBC. However, when I try to connect to the data source in the Database Wizard, I get the following error: SQL ExecDirect failed: [Microsoft] [ODBC Excel Driver]The connection for viewing your linked excel worksheet was lost. What is wrong?

Resolving The Problem

This happens when you are trying to run a query using an ODBC connection to an Excel spreadsheet and have the spreadsheet open at the same time. Please close the Excel spreadsheet and Statistics, then restart Statistics and try again.

Badge +5

 

@Abhi25 : will you be able to establish ODBC Excel Driver successfully ?

 

[Microsoft][ODBC Excel Driver] The connection for viewing your linked Microsoft Excel worksheet was lost.

Troubleshooting

 

Problem

I am trying to open an Excel file in Statistics using ODBC. However, when I try to connect to the data source in the Database Wizard, I get the following error: SQL ExecDirect failed: [Microsoft] [ODBC Excel Driver]The connection for viewing your linked excel worksheet was lost. What is wrong?

Resolving The Problem

This happens when you are trying to run a query using an ODBC connection to an Excel spreadsheet and have the spreadsheet open at the same time. Please close the Excel spreadsheet and Statistics, then restart Statistics and try again.

Thanks for your reply Ramesh, no excel sheets are opened and I am getting the error at that line of code where it firing the select query. Since the connection to the excel sheet is always done prior to using any kind of query and I am not getting any error at that line of code, so I am assuming that the connection should have been successful.

Userlevel 4
Badge +7

Hi @Abhi25 ,

We usually kill the applications the bot is about to work with during initialization, so you could try killing EXCEL.EXE and any other applications that could interfere with the process run using the Application: Open Action like so:

Location: Taskkill
Parameters: /F /FI "USERNAME eq $systemUsername$"  /IM excel.exe /IM chrome.exe /IM OUTLOOK.EXE

Kind Regards,
Ashwin A.K

Badge +5

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Only in that particular I am using excel as database & getting an error for the past couple of run

 

If that’s the case then, try to change the Database Package version and check.

Thanks for the suggestion, will let you the results post today’s run

After updating the package version to the latest one, for the last couple of runs I have not seen the above error come up, hope it is resolved for now.

Userlevel 7
Badge +13

 

Hi @Abhi25 ,

 

Is this specific to a Bot or are you facing same issue for all Bots where Database command in place?

Only in that particular I am using excel as database & getting an error for the past couple of run

 

If that’s the case then, try to change the Database Package version and check.

Thanks for the suggestion, will let you the results post today’s run

After updating the package version to the latest one, for the last couple of runs I have not seen the above error come up, hope it is resolved for now.

 

Thanks for the update. Happy to assist always.

Reply