23 Jun’17

D365 Business CentralExport data to Excel in Dynamics NAV with Column captions using XML port


With the help of XML port, it is possible to import and export data in Dynamics NAV. While exporting data to an Excel sheet, we always have a requirement to export data along with the column captions to an excel sheet.

In this blog article, I will be explaining the procedure to achieve the same.


Microsoft Dynamics NAV 2017


  1. Enter a node name. I have entered my node name as ‘Root’ with Node Type as ‘Element’ and Source Type as ‘Text’.

  1. For the caption names, first create a node with Node Type as ‘Element’ and Source Type as ‘Table’. Enter the Data Source as ‘Integer’ which is a virtual table in Dynamics NAV.

  1. Now enter a node name for your first caption name. In this example, I have entered ‘VINTitle’ as my first column caption name with Node Type as ‘Element’ and Source Type as ‘Text’.

  1. Go to C/AL code of ‘VINTitle’ which is my first node name and in ‘OnBeforePassVariable()’ write the code for the caption name that should appear in the Excel sheet when data is exported.This will display the name of the field which is entered in the table or you can also manually assign the name of the caption that should appear in the Excel sheet after exporting data as shown below.

  2. After the caption name is mentioned, now you have to enter the value which should be fetched from the table and appear in the Excel sheet.
  3. Enter the node name for your table with ‘Node Type’ as ‘Element’ and Source Type as ‘Table’. Enter your Data source. In this I have taken ‘Item’ as my Data source and the field ‘No.’ of Item table.


After exporting data to an Excel sheet, the column captions appear in it along with the values of the column.


Written by

Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Reading more then 10K records in D3FOE OData API

    11 July’ 2018

    Introduction: We all know Dynamics 365 Finance and Operations has limitation of 10K records to be fetched at a time usi...

    Read more
  • Paging in D365 Customer Engagement v9.0

    10 July’ 2018

    Introduction: The Xrm.retrieveMultipleRecords method is used to retrieve a collection of records in Dynamics 365 Custom...

    Read more
  • Set up Dynamics 365 connection in Microsoft Social Engagement

    10 July’ 2018

    Introduction: This blog explains how to Set up Dynamics 365 connection in Microsoft Social Engagement. Steps to be follo...

    Read more
  • Voice of the Customer failed to install

    10 July’ 2018

    Introduction: Many people face issues in installing Voice of Customer solution on v9 environment and trying repeatedly ...

    Read more
  • Scribe Insight AX as a Web Service Find Block issue

    10 July’ 2018

    Introduction: If we need to look up for any value from AX then we do it by using a Find Block in Scribe Insight Eg: Basi...

    Read more