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 :
Small and medium business | Business Central, N...
Answered

How to Import CSV file by removing the header column

(0) ShareShare
ReportReport
Posted on by

I am trying to import a csv file through xml port, I Need to remove the header column , how is it possible , any help will be great,Thanks

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    try as per below on Onbeforeinsertrecord() trigger

    if GlobalVar = 0 then

     currXMLport.SKIP;

    GlobalVar += 1 ;

    declare globalVar as global variable as Integer

  • Verified answer
    Nrims Profile Picture
    50 on at

    Hey !

    I'v got the same issue recently and i found a solution.

    The goal is to initialize a boolean variable and to execute it only once.

    In the xmlport we create an OnPreXmlPort trigger which initializes the variable to true.

    Then in the table we create the OnAfterInitRecord trigger which executes the variable only once and which will use the currXMLport.Skip() function which allows to ignore the first line of the CSV file, the header.

    Exemple:

    xmlport ID "Name"
    {
        Format = VariableText;
        Direction = Import;
        UseRequestPage = false;
    
        schema
        {
            textelement(Root)
            {
                tableelement("Import CSV Table"; "Import CSV Table")
                {
                    XmlName = 'Import';
    
                    fieldelement("Something"; "Table"."Something")
                    {
                    }
                    fieldelement(Date; "Table".Date)
                    {
                    }
                    fieldelement(Type; "Table".Type)
                    {
                    }
    
                    trigger OnAfterInitRecord()
                    begin
                        if firstline then begin
                            firstline := false;
                            currXMLport.Skip();
                        end;
                    end;
                }
            }
        }
        var
            firstline: Boolean;
        // Initialize the flag on pre-xmlport event
        trigger OnPreXmlPort()
        begin
            firstline := true;
        end;
    }

  • Community Member Profile Picture
    on at

    Thank you Nitin Verma  it helped

  • Elijah Stownton Profile Picture
    192 on at

    Another option to import CSV to Dynamics is to use Skyvia. It is a no code SaaS.

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,796 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 965 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 664 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans