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

Appending data to existing excel

(0) ShareShare
ReportReport
Posted on by 30

Hi ,

I am trying to appending row data to a existing excel file via x++ code. While trying to append rows, the process is working fine but atlast the datas are not added to the excel. The iteration are executing correctly while debuging. But i think saving the file with memoryStream is happening some issue. Can anyone help me in this.

pastedimage1678878430973v2.png

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Anoop, I am not sure but can you try moving package.Save() inside the loop before i++.

    Check this article

    www.d365snippets.com/.../how-to-create-and-export-excel-files-using-xpp-in-d365.html

  • Verified answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Will it change if you save it to another stream with SaveAs()?

    using (System.IO.MemoryStream outputStream = new System.IO.MemoryStream())
    {
    	package.SaveAs(outputStream);
    	File::SendFileToUser(outputStream, 'test.xlsx');
    }

  • Anoop B Profile Picture
    30 on at

    Thanks Martin, Actually It worked

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans