Skip to Content

Read the data from CSV File

Hello Experts,

In my project i came across a requirement where there are lots of records in a CSV file and i have to create all the records using Batch Operation upon clicking the upload button.

Can you please help me how to read the data of the file in the runtime , what i feel is that i have to know the url of my local file first and then read the file data using AJAX but am not getting any clue for how to get the url of the file during run time.

Please help me in this.Thanks in advance.

Regards,

Vikash

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Oct 16, 2015 at 11:45 AM

    Hi Vikash,

    <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);

    }

    Refer from :

    @Raman Sharapinski Comment.

    var strCSV= e.target.result; //string in CSV - Here you will get your csv file records



    Thanks,

    Karthik A

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.