0

In Angular 5 (Typescript) web app. How to open an existing Excel file from a hard drive, please?

In my previous Java projects, we used servlets for this. But this is a NodeJS project.

Update:-

I tried other options like below but got chrome error - "Not allowed to load local resource:"

<a href="file://c:/test.xls" target="_blank">Click me!</a>

Are there any serverside options available using NodeJS, Express, etc? Still trying to figure out.

Jay
  • 9,189
  • 12
  • 56
  • 96
  • 1
    Possible duplicate of [How to open a local disk file with Javascript?](https://stackoverflow.com/questions/3582671/how-to-open-a-local-disk-file-with-javascript) – Aravind Mar 14 '18 at 11:29
  • 1
    A web app cannot access a users hard drive directly to get files out, as that would be a huge security issue. Imagine if you went onto facebook and it could steal all your pictures out of your pictures folder. If you meant something else then please clarify :) You can ask the user to select the file using a file input though. – Mongoose Mar 14 '18 at 11:46
  • @Mongoose Thanks, yes these files are stored in network hard drive. Are there any other alternatives to open files stored in network? – Jay Mar 14 '18 at 11:49
  • Is the network drive accessible publicly, or on the same network as your web server? If so, you could potentially code a back-end solution to retrieve the files from the network drive,. – Mongoose Mar 14 '18 at 12:00
  • This is an internal web application and the file is stored in the internal network. – Jay Mar 14 '18 at 12:06
  • 1
    Why not create a WebService that can access the internal files, exposes a HTTP interface, and then from your WebApp perform a Get for that file? – Beni Murza Mar 14 '18 at 12:33
  • @BeniMurza Thanks, I would try that. – Jay Mar 14 '18 at 12:35

0 Answers0