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 :
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
    238,769 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 509 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 375

#3
Adis Profile Picture

Adis 268 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans