Skip to main content

Posts

Showing posts from September, 2022

Import CSV file using CSV Buffer in Business Central

Hi Everyone,  In this article we will see how we can Import Data (CSV/Excel format) in Microsoft Dynamics 365 Business Central. Here i am using CSV Buffer as a record variable to read data from csv file for temporary basis and then will store it to Master table. Let us take a scenario to import CSV file to Employee Table. Step-(1) First analyze the format/ structure of the csv data file as shown below: Step-(2) Secondly based on the data format and columns, create a new Procedure/function on Codeunit to choose and import file using the dialog box to read the data. codeunit 50001 "CSV Import" {     trigger OnRun ()     begin     end ;     procedure ImportEmployeeDetailViaCSVBuffer ()     var         csv_InStream: InStream ;         uploadResult: Boolean ;         csvFileName: Text ;         csvBuffer: Record "CSV Buffer";         RecEmployee: Record Employee;     begin         if UploadIntoStream ( 'Import Employee CSV' , '' , '' , c