I have solved this issue of Download csv file to excel sheet for both web as well as app,in this file you need to convert your json API into csv format for that we have to use Papaparse plugin ,have share the link below.
http://papaparse.com/
url = encodeURI("//put your API hear");
this.http.get(this.url).subscribe(res => {
result = res.json();
var csv = Papa.unparse(result);
}
after convert json to csv we need to download the csv file using cordova.file.writeFile
In this we can use this method directly in component or we can use it in providers.In my case i have used in provider so i can use it in multiple components.
I have solved this issue of Download csv file to excel sheet for both web as well as app,in this file you need to convert your json API into csv format for that we have to use Papaparse plugin ,have share the link below. http://papaparse.com/
after convert json to csv we need to download the csv file using cordova.file.writeFile In this we can use this method directly in component or we can use it in providers.In my case i have used in provider so i can use it in multiple components.
// File.service Provider
then use it in component as below.
this.fileService.save(this.file.externalRootDirectory, "file.csv", "text/csv", csv);
and the code of component as below.Thank you.