Skip to Content
0

Saving JSON data as an excel file / csv file

Sep 29, 2017 at 05:59 PM

86

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Sep 30, 2017 at 11:55 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded
A K Oct 03, 2017 at 06:27 AM
1
Share
10 |10000 characters needed characters left characters exceeded