How to open excel file using JavaScript code without using ActiveX control?
It's possible to open .xlsx files with Javascript because they are ZIP packages. This has been experimented with XForms: http://www.w3.org/community/xformsusers/2012/12/19/editing-zip-with-xforms/
Javascript Excel OpenFile
Firstly, try moving your script to the bottom of the body. You should also set your Excel
variable to be visible. And there's a typo with the line Excel.Workbook.Open("teste.xlsx");
(should be Workbooks
). The following is working for me in IE. I don't think it will work in other browsers:
<html>
<body>
<form name="form1">
<input type=button onClick="test()" value="Open File">
<br><br>
</form>
<script type="text/javascript">
function test() {
var Excel = new ActiveXObject("Excel.Application");
Excel.Visible = true;
Excel.Workbooks.Open("teste.xlsx");
}
</script>
</body>
</html>
Open Excel file url in excel (from source, not downloaded copy)
No it is not possible for security reasons. All newer browsers (and I guess even the newer implementations of IE), don't allow file access to the local system. Internet Explorer is the only browser that supports opening files from locations, that are seen and treated as local ones.
You can open files from a Webdav Server, which is probably, why you can access files from your SharePoint, so you could try mapping that provider of your network drive as a Webdav Server.
Source: https://www.codeproject.com/Questions/1180249/Open-edit-save-excel-sheet-from-browser-using-java AND
Is there an Application URL Protocol for MS Word?
How to manipulate Excel file on the client side
As a dirty workaround, how about generating a .bat file with the appropriate DOS copy commands? If your user is happy to download and execute the file, it might do the job!
I've done something similar with a web app that generates commands for a local macro program.
For example:
You might save the following to copy the file to the correct directory
copy c:\\path\to\download\file.xls n:\\path\to\networked\destination
or you could make use of built in windows commands to handle the file download
curl.exe -0 c:\\path\to\download\file.xls https://domain_with_file.com/file.xls
This isn't an ideal way of doing things though, and it looks as if any batch files downloaded might be flagged up as potential virus threats.
Related Topics
Java: How to Print Array Without Square Brackets and Commas
How to Store a String Longer Than 4000 Characters in an Oracle Database Using Java/Jdbc
How to Convert a One-Dimensional Array to Two-Dimensional Array in Java
How to Update Only the Incoming Fields in a Model Using Spring Data Jpa
Shifting Characters Within a String
Wrong Answer in Task - Mistake in Algorithm
Arraylist: How Does the Size Increase
Knowing Which Java.Exe Process to Kill on a Windows Machine
How to Close a Javafx Application on Window Close
Why Do I Get 404 for Rest With Spring-Boot
How to Process a Multipart Request Consisting of a File and a Json Object in Spring Restful Service
How to Identify File Type by Base64 Encoded String of a Image
Java Stream Collectors.Groupingby() Multiple Fields
Could Not Extract Resultset in Hibernate
Spring Junit: How to Mock Autowired Component in Autowired Component
Null Pointer on an Autowired Bean Which Is Not Mocked by Mockito