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. 

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Excel import in AX2012

    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.

  • RE: Excel import in AX2012

    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.

  • RE: Excel import in AX2012

    Hi Ludwig,

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

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Excel import in AX2012

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

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Excel import in AX2012

    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
    Ludwig Reinhard Microsoft Employee on at
    RE: Excel import in AX2012

    Hi mahiims18,

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

    Can you share details about your job?

    Many thanks,

    Ludwig

  • RE: Excel import in AX2012

    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

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: Excel import in AX2012

    Hi mahiims18,

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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans