cancel
Showing results for 
Search instead for 
Did you mean: 

Browsing and uploading csv/excel file in sap ui5 m table

Former Member

Hi Experts,

I am working in an assignment and i have a requirement where i need to browse and upload a csv/ excel file in to a sap.m table. I know about sap.m.UploadCollection, but not able to get the file uploaded in to the ui5 client side table.

Please provide some suggestions here.

Regards,

Imran

Accepted Solutions (0)

Answers (3)

Answers (3)

Hi, I use sap.ui.unidied.FileUploader and file API(supported all modern browsers and IE10+).


<FileUploader xmlns="sap.ui.unified"

  uploadUrl=""

  buttonText="{i18n>detailBtnImport}"

  fileType="csv"

  maximumFileSize="1"

  buttonOnly="true"

  icon="sap-icon://upload"

  change="onChangeFUP"

  uploadComplete="onUploadCompleteFUP"

  typeMissmatch="onFailedFUP"

  fileSizeExceed="onFailedFUP"

  uploadAborted="onFailedFUP"

  filenameLengthExceed="onFailedFUP"/>


onChangeFUP : function(e) {

  this._import(e.getParameter("files") && e.getParameter("files")[0]);

},

_import : function(file) {

  if(file && window.FileReader){

  var reader = new FileReader();

  var that = this;

  reader.onload = function(e) {

  var strCSV= e.target.result; //string in CSV

  };reader.readAsText(file);

}

Regards,
Raman

santhu_gowdaz
Active Contributor
0 Kudos

former_member225463
Participant
0 Kudos

Hi Santosh,

Am able to extract the csv file into json format , but am not able to bind it to the sapui5 table.

could you please help me.

Please check my code :

otable1.bindAggregation("items",{

  path: "/modelData",

  template : coltemplate

  });

  };

modelData contains the records in json format

Regards,

Vikash

Former Member
0 Kudos

Hello Imran,

Have a look into the below blog,