on 12-06-2018 10:36 AM
Hi,
I am uploading an xlsx file to my file uploader. The file then goes to the backend through gateway.
Is there any way I can convert the file to csv in my controller and then send csv to backend?
Please Help
Thanks
Mahesh's Answer worked for me.:
Thanks Mahesh 🙂
you need set the property for the file uploader:
useMultipart="false" // This needs to be false else the data is uploaded as multiform type instead of excel type
If you would have use uploadcollection it works by default.
PS: I've spent at least 2 hours to replicate and find this issue reason and at the end I found it is a very minor issue. Great learning for me as well!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shubh,
you can use opensource libraries to convert the XLSX file to CSV file.. one such popular library:
https://github.com/SheetJS/js-xlsx
Or you can do it in the backend itself:
// LV_Content should be xstring format
DATA(lr_excel) = NEW cl_fdt_xl_spreadsheet( document_name = iv_file_name xdocument = lv_content ).
IF lr_excel IS BOUND.
lr_excel->if_fdt_doc_spreadsheet~get_worksheet_names( IMPORTING worksheet_names = DATA(lt_worksheets) ).
ENDIF.
DATA(lr_worksheet_itab) = lr_excel->if_fdt_doc_spreadsheet~get_itab_from_worksheet( lo_worksheets->* ). // Pass worksheet name, will return dynamic data
ASSIGN lr_worksheet_itab->* TO <ft_excel_data>.
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi I am trying the below code but it is giving dump on line 1 .Error=> "Invalid File Format".
is_media_resource-value has xstring value only.
Please Help
DATA(lr_excel) = NEW cl_fdt_xl_spreadsheet( document_name = iv_name xdocument = is_media_resource-value ).
IF lr_excel is BOUND.
lr_excel->if_fdt_doc_spreadsheet~get_worksheet_names( IMPORTING worksheet_names = DATA(lt_worksheets) ).
ENDIF.
Hi Shubh Agarwal,
you need set the property for the file uploader:
useMultipart="false" // This needs to be false else the data is uploaded as multiform type instead of excel type
If you would have use uploadcollection it works by default.
PS: I've spent at least 2 hours to replicate and find this issue reason and at the end I found it is a very minor issue. Great learning for me as well!
BR,
Mahesh
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.