I want to convert an excel file to a JSON, but at first, I want to find a way to access my excel file, which is in the assets folder, from app.component.ts- Can anyone help me, please?
Asked
Active
Viewed 1,920 times
2 Answers
0
import example from '../assets/example.json';
This should work, but may I ask why you are storing it in your assets folder? I used to do this to and figured that creating a rest-api almost always is better, even if it's a mock.

TKTurbo
- 92
- 1
- 11
-
He wants to read an excel file from his assets to transform it into a JSON. – ak.leimrey Nov 11 '19 at 15:38
0
In short, it's not possible to do what you want. While you can read such files with the HTML5 Filereader API on a client-side basis, you can't simply pass the folder in your methods to make this work. Javascript has no immediate access to the system files. That's something Node.js solves - being a backend technology - but you can't do this on Angular.
You can read more about it in this question...

ak.leimrey
- 1,137
- 2
- 11
- 25