Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Is it possible to export a json data getting from a POST method in Angular JS to excel in .csv or .xls format?On click of a button?

share|improve this question
    
yes it is possibly for example ng-csv – Grundy Dec 4 '15 at 9:05
    
i use ng-csv too. great module – AlainIb Dec 4 '15 at 9:13

All you have to do is to send a request to your server and this one generates the file, for example csv, and add those headers to the request:

header('Content-Description: File Transfer');
header("Content-Type: application/csv") ;

Then your browser will download the file automatically.

If you need to generate the file in the browser you can use ng-csv but in my opinion I would use the first one.

share|improve this answer

before answering your question i would like to know what type of data you are exporting to excel or csv .

If u r using ng-csv directive then you can't export your data to excel files . If u are planning ahead to export in other file formats also then there ia a library u can use .

alasql.js

Here is a link if u are interesed to know more about this library

https://github.com/agershun/alasql

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.