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)

Write Data to an Excel File in D365

(0) ShareShare
ReportReport
Posted on by

Hi,

We are importing an excel file in D365 and based on the data entered in the Excel file we are adding certain validations.

In case of any error, we need to write the error message to the same excel file which is being used.

We would request if someone would help us with how to write data to the same excel file which is being used to import data?

Thanks.

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    304,121 Super User 2026 Season 1 on at

    Hi Tatha,

    When you are using the Excel add-in, the feature is already there. Are you using custom code for import? Or are you using standard data import features based on data entities?

  • Community Member Profile Picture
    on at

    Hi Andre

    I am using custom code to import data in D365.

  • André Arnaud de Calavon Profile Picture
    304,121 Super User 2026 Season 1 on at

    Can't you use the standard features for data import or the Excel add-in? What makes it special to write own coding? There is an example how to create Excel files in the standard application. E.g. the collection features do have a feature to create an Excel file with a certain format. You could learn from that part.

  • Community Member Profile Picture
    on at

    Hi Andre,

    Sorry I guess I was not clear with the problem statement.

    The issue we are facing is that the client will be providing us with an excel file with relevant data and using that we need to create a Ledger journal.

    In case we encounter errors while uploading the same, we need to write that error message back to the excel file which was used for uploading.

    So we have uploaded the file but we are not sure how to write the error message in the excel file.

    This is where we needed your input.

    Thanks.

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

    How do you upload the files?

  • Community Member Profile Picture
    on at

    Hi Martin,

    By uploading I meant reading data from the Excel file and creating journal in AX based on it.

  • André Arnaud de Calavon Profile Picture
    304,121 Super User 2026 Season 1 on at

    Hi Tatha,

    Have you looked at the Data Management features in D365? It will import and give error details in D365. Then you don't need these customizations. It would require some attention from security point of view to provide access to the correct entity.

  • Community Member Profile Picture
    on at

    Hi Andre,

    I am not aware of this feature in D365. I will check it and will update you if it fixes my problem.

    Thanks.

  • Suggested answer
    Fedir Kryvyi Profile Picture
    1,026 on at

    You can use DociumentFormat.OpenXML or OpenOfficeXML(or other similar library) to solve this:

    1. You will need to have some custom dialog that enables user to upload file,

    2. After file is being uploaded, grab it's Stream to initialize new instance of OpenXml.Spreadsheet

    3. Validate lines one by one and populate error messages back to file using SDK that you have chosen

    4. Save file from stream and send it back to user with File class

    Here is a tutorial for file upload in D365: link

    And tutorial for OpenXML: link

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans