neo_phyte
neo_phyte

Reputation: 1

Possible to automate Excel running on desktop from web app?

We are upgrading a VB6 desktop app and I am investigating the possibility of converting it to a web app. However one of the main features of this app is that it automates Excel from the VB6 code; see Automation

Therefore, is it possible for a web app, either from server-side code (running on web server) and/or client-side code (running in web browser), to control an Excel executable running on the client's desktop?

The code will need to call on the Excel executable to manipulate Excel workbooks, set visibility of worksheets, unprotect worksheets, clear contents from ranges, as the user (an accountant) interacts with the web app and Excel.

ActiveX might be out of the question due to security reasons (https://msdn.microsoft.com/en-us/library/aa752035(v=vs.85).aspx) although it is an intranet app.

If this is not possible, are there alternative ideas to achieve similar results?

Upvotes: 0

Views: 252

Answers (1)

Chris
Chris

Reputation: 37

Based on my Windows development experience, my suggestion would be to create a .net dll that will serve as an intermediary between the browser and Excel. This dll would host an embedded http or websocket server, depending upon whether your use case would be better served by utilizing the stateless request/response model or the persistent connection provided by a websocket. The embedded server would then be callable from your web application JavaScript through the provided xmlhttp functionality or an HTML5 websocket respectively. The .net dll would also provide the interface to Excel through .net's interop mechanism. Some issues to consider with these options are:

  • Security - Windows requires that specific permissions be granted to the user/group to start up an http based listener
  • How does the server get launched? - you could have a html link to an excel document on a page of your web app that invokes your .net executable when loaded (there may be security issues to contend with here also). You could also incorporate your .net assembly into a Windows service project and configure the resulting application to start automatically via the Windows Service Control Manager.

Some links to get you started:

I hope this helps.

Upvotes: 1

Related Questions