web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Excel import in AX2012

(0) ShareShare
ReportReport
Posted on by

Hi,

During Excel import Empty lines from .csv file is reading.

For example in my case I have only 5 records in .csv but after running my x++ job it is processing 15 records i.e. 10 empty lines along with my 5 records. How to avoid these empty lines. 

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi mahiims18,

    Could you please share the code you are using in the job?

  • Community Member Profile Picture
    on at

    container   roles,readCon;
        counter     icount,inserted;
        int recCount =0,fvalid=0;
        delete_from maCustUpdate;
        csvFile = new CommaIO(filename, 'r');
        try
        {
            if (csvFile)
            {
                readCon = csvFile.read();
                while (csvFile.status() == IO_Status::OK)
                {
                    readCon = csvFile.read();
                    fvalid  ;
                    if(readCon)
                    {
                        icount  ;

    This was part of my code, I have almost 200 lines.

    While reading the line number 10 is reading 10 lines at a time even though I have 5 records in my .csv file

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi mahiims18,

    What data do you try to import from a .csv file?

    Can you share details about your job?

    Many thanks,

    Ludwig

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi mahiims18,

    What data do you try to import from a .csv file?

    Can you share details about your job?

    Many thanks,

    Ludwig

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Open the CSV in Notepad. Most likely you have empty lines in the end of the file. Remove them and try to import again.

  • Community Member Profile Picture
    on at

    Hi Ludwig,

    from .csv file I have customer addresses to be updated.

  • Community Member Profile Picture
    on at

    Hi Nikolaos

    when I can clear the content of empty lines in csv file it is working fine for me but I am wondering why my code is reading empty lines some times.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    I assume it always reads empty lines if the file has empty lines.

    You can check if the line has contents before writing anything to the database.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans