Skip to main content

Notifications

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

  • Anoop B Profile Picture
    Anoop B 30 on at
    RE: Appending data to existing excel

    Thanks Martin, Actually It worked

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: Appending data to existing excel

    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');
    }

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Appending data to existing excel

    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

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans