Skip to main content
Solved

Excel as Database connection lost Error

  • December 29, 2022
  • 9 replies
  • 1007 views

Forum|alt.badge.img+5
  • Navigator | Tier 3
  • 22 replies

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 ?

Best answer by Padmakumar

Abhi25 wrote:
Padmakumar wrote:

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.

View original
Did this topic help answer your question?
This topic has been closed for comments

9 replies

Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • December 29, 2022

Hi @Abhi25 ,

 

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


Forum|alt.badge.img+5
  • Author
  • Navigator | Tier 3
  • 22 replies
  • December 29, 2022
Padmakumar wrote:

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


Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • Answer
  • December 29, 2022
Abhi25 wrote:
Padmakumar wrote:

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.


Forum|alt.badge.img+5
  • Author
  • Navigator | Tier 3
  • 22 replies
  • December 29, 2022
Padmakumar wrote:
Abhi25 wrote:
Padmakumar wrote:

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


rbkadiyam
Forum|alt.badge.img+16
  • Navigator | Tier 3
  • 578 replies
  • December 29, 2022

 

@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.


Forum|alt.badge.img+5
  • Author
  • Navigator | Tier 3
  • 22 replies
  • December 29, 2022
rbkadiyam wrote:

 

@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.


Ashwin A.K
Forum|alt.badge.img+8
  • Navigator | Tier 3
  • 2445 replies
  • December 31, 2022

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


Forum|alt.badge.img+5
  • Author
  • Navigator | Tier 3
  • 22 replies
  • January 2, 2023
Abhi25 wrote:
Padmakumar wrote:
Abhi25 wrote:
Padmakumar wrote:

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.


Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • January 2, 2023

 

Abhi25 wrote:
Abhi25 wrote:
Padmakumar wrote:
Abhi25 wrote:
Padmakumar wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings