7

I am trying to have a user upload an excel file from their computer then convert it to JSON. I am needing these files as JSON. I have it so they can upload a csv to JSON. Now I am wanting excel to JSON. Any advice or guidance on this would be appreciated. This needs to be done using angularJS. Thanks!

2
  • 1
    Can you provide any code that you have attempted? Commented Feb 18, 2015 at 17:40
  • 1
    joyofdata.de/blog/… somewhat doable Commented Feb 18, 2015 at 18:08

2 Answers 2

3

Forget about file manipulation using AngulaJS. Angular is a front-end JS framework with no file manipulation support whatsoever. You need to have access to server where the file is stored and you will only get it with server side language.

EDIT:

Ok, I have learnt that you can use FileReader API or $parse Angular service to read file contents on the front-end, which is really cool.

Option A: Read this StackOverflow question and answer and follow the plnkr to see an example of FileReader API being used with Angular. Kudos to @MajoB for providing an excellent answer and code sample.

Option B: Check official Angular documentation to read about $parse service and check this fiddle to see it in action.

Unfortunately neither FileReader API nor $parse service can read Excel files. They can read .txt, .csv, .json, and even .html but not .xlsx

Sign up to request clarification or add additional context in comments.

2 Comments

I am trying to have the user upload a file and my controller will take it in and do all the data manipulation.
Hi Troy, I edited my original answer, it looks like there are ways to parse file contents on the front-end.
1

Example code :

http://jsfiddle.net/d2atnbrt/3/

External library:

https://github.com/SheetJS/js-xls

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.