cancel
Showing results for 
Search instead for 
Did you mean: 

Saving JSON data as an excel file / csv file

sprajapati1
Member
0 Kudos

I have a table on UI5 application, and I want the download of that data to have some additional columns (than what is shown on the screen).
So I developed an oData which returns the required data as a JSON string.
Now I am having a difficult time saving the JSON as an excel / csv.
I tried the solution in http://jsfiddle.net/hybrid13i/JXrwM/ but it works only in Chrome.
a) How can I get the above to work in IE, and
b) Is there any other way in which I can save JSON data as a csv/excel file upon click of a button.

Accepted Solutions (0)

Answers (2)

Answers (2)

karthikarjun
Active Contributor
Former Member

Hi,

If you are using sap.ui.table.Table and want to download the complete table in csv file then you can use:

var oTable = this.getView().byId("idTable");
oTable.exportData().saveFile("File_Name");

If you want to download JSON data then you can see the API sap.ui.core.util.Export

https://sapui5.hana.ondemand.com/1.44.14/#docs/api/symbols/sap.ui.core.util.Export.html