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
    101,158 Moderator 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.

  • Community Member Profile Picture
    on at
    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.

  • Community Member Profile Picture
    on at
    RE: Excel import in AX2012

    Hi Ludwig,

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

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator 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
    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
    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

  • Community Member Profile Picture
    on at
    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
    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,145 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,917 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans