cancel
Showing results for 
Search instead for 
Did you mean: 

Read excel data from frontend using SAP ODATA into Ztable

former_member420959
Participant
0 Kudos

Hello All,

I have a requirement in SAP Odata to read an excel file that will be uploaded in SAP UI5 application , read the contents of the file and upload the same in a ztable.

I am getting Xstring of the uploaded file as input to the CREATE_STREAM method. But i see that the Xstring of the file is different from that if upload from sap gui for the same file. Do anything needs to be done in front end to achieve the requirement .

My UI developer said that there is nothing extra that need to be done in for excel . If so can anyone explain how this can be handled from backend.

Regards

Ujwal

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ujwal,

Could you please check the below mentioned blog. I think this will help to resolve your issue.

Thanks,

Myil

former_member420959
Participant
0 Kudos

Thanks Myilraja,

But in my requirement I need to read the data in the uploaded excel. they will upload only excel in this case. So i need to read each column data and store in Z table.

Please help of this can be done.

EkanshCapgemini
Active Contributor
0 Kudos

Hi Ujwal,

You can not decode XLS encoding of XSTRING in ABAP. This is the common case and the only solution is to use CSV files. These CSV files can be edited in MS EXCEL so this should not be major problem for users. You can check my blog on this.

Regards,

Ekansh

former_member420959
Participant
0 Kudos

Thanks Ekansh for the reply.

Do you mean that there is not functionality in SAP UI5 to upload the excel and read the data from the front end.

Is there no other option to stick to excel itself and read the data to backend?

Regards

Ujwal

EkanshCapgemini
Active Contributor
0 Kudos

Hi Ujwal,

As much as I know, SAPUI5 doesn't have this functionality out of the box in its library. CSV is a valid option if you want to convert it server-side.

If you want to convert it on client-side, you can check this project GitHub - SheetJS/js-xlsx: XLSX / XLSM / XLSB / XLS / SpreadsheetML (Excel Spreadsheet) / ODS parser ... .

I have not tested this so can't comment much on this. However reading a large excel file at client-side would not be recommended as it might cause serious memory issue specially on the mobile/tablet devices. You can check this thread for more info on using this library Read contents of Excel file into Sapui5 table | SCN

Regards,

Ekansh