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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Append line to an existing csv file

(0) ShareShare
ReportReport
Posted on by

Hi All,

I want to open an existing csv file and append record/line to it from AX 2012 Job. Every time I am trying to do that it is replacing the file with new set of record.

Please advice.

Thanks and Regards,

Arindam

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,602 Most Valuable Professional on at

    Let's start with an example:

    #File
    CommaTextIo io = new CommaTextIo(@'c:\temp\test.csv', #io_append);
    ;
    io.write("abcd", 123);

    You can run this code several times and it always add another line to the file.

    The second parameter of CommaTextIo's constructor is crucial - if you use #io_write (or 'w') instead, the existing file content will be overwritten.

     

  • Community Member Profile Picture
    on at

    Hi Martin,

    It worked. thank you. I was using #io_write. In that way every time it was creating a new file and line. Now after using #io_append I am getting desired out put.

    Thank you.

    Regards,

    Arindam

  • Community Member Profile Picture
    on at

    Hi Martin,

    I have to do the same for all the files which are in one particular folder,how can mention the path to do the same.

    Can you please suggest.

  • Community Member Profile Picture
    on at

    Adding to the previous .. I have  6 columns in CSV, for 5th column  last row I need to add the particular Text.

    How to mention the particular column and last row, please suggest if any?

    Thanks

    Hari

  • Martin Dráb Profile Picture
    239,602 Most Valuable Professional on at

    If you have more files, you'll use the same, just several times (once for each file).

    The other question isn't related to the topic of this thread ("Append line to an existing csv file"); please create a new one (with an appropriate title and tags) and explain your problem there.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 24

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans