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

Regarding - Excel File is not getting Imported but the the message 'Successfully Imported' displayed.

(1) ShareShare
ReportReport
Posted on by 190

Hi all...

I had developed a new page and i declared the import excel in actions .But I'm not able to import the data into the page, whereas I received 'EXCEL IS SUCCESSFULLY IMPORTED'.

  action(Import)
            {
                Caption = '&Import';
                Image = ImportExcel;
                Promoted = true;
                PromotedCategory = Process;
                ApplicationArea = All;
                ToolTip = 'Import data from excel.';

                trigger OnAction()
                var
                begin
                    ReadExcelSheet();
                    ImportExcelData();
                end;
            }
And I have declared local procedure for ReadExcelSheet() & ImportExcelData() and published with no errors.
help me out of this ..
I have the same question (0)
  • JAngle Profile Picture
    152 on at

    Would need the code of the procedures

  • Suggested answer
    Nitin Verma Profile Picture
    21,794 Moderator on at

    Hi,

    As @Josh Anglesea mentioned, can you please update your code here for the Read and Import functions you used.

    Thanks

  • karthikeyani c Profile Picture
    190 on at

    local procedure ReadExcelSheet()

       var

           FileMgt: Codeunit "File Management";

           IStream: InStream;

           FromFile: Text[100];

       begin

           UploadIntoStream(UploadExcelMsg, '', '', FromFile, IStream);

           if FromFile <> '' then begin

               FileName := FileMgt.GetFileName(FromFile);

               SheetName := TempExcelBuffer.SelectSheetsNameStream(IStream);

           end else

               Error(NoFileFoundMsg);

           TempExcelBuffer.Reset();

           TempExcelBuffer.DeleteAll();

           TempExcelBuffer.OpenBookStream(IStream, SheetName);

           TempExcelBuffer.ReadSheet();

       end;

    local procedure ImportExcelData()

       var

           SOImportBuffer: Record Recruitment;

           RowNo: Integer;

           ColNo: Integer;

           LineNo: Integer;

           MaxRowNo: Integer;

       begin

           RowNo := 0;

           ColNo := 0;

           MaxRowNo := 0;

           LineNo := 0;

           SOImportBuffer.Reset();

           if SOImportBuffer.FindLast() then

               LineNo := SOImportBuffer."Line No.";

           TempExcelBuffer.Reset();

           if TempExcelBuffer.FindLast() then begin

               MaxRowNo := TempExcelBuffer."Row No.";

           end;

           for RowNo := 2 to MaxRowNo do begin

               LineNo := LineNo + 10000;

               SOImportBuffer.Init();

               Evaluate(SOImportBuffer.Title, Rec.Title);

               SOImportBuffer."Line No." := LineNo;

               Evaluate(SOImportBuffer."Title", GetValueAtCell(RowNo, 1));

               Evaluate(SOImportBuffer."Name as per(Legal)", GetValueAtCell(RowNo, 2));

               Evaluate(SOImportBuffer."Email", GetValueAtCell(RowNo, 3));

               Evaluate(SOImportBuffer."Date of Birth", GetValueAtCell(RowNo, 4));

              Evaluate(SOImportBuffer."Gender", GetValueAtCell(RowNo, 5));

              Evaluate(SOImportBuffer."Phone number", GetValueAtCell(RowNo, 6));

             Evaluate(SOImportBuffer."Institute Name", GetValueAtCell(RowNo, 7));

             Evaluate(SOImportBuffer."Qualification", GetValueAtCell(RowNo, 8));

              Evaluate(SOImportBuffer."Course name", GetValueAtCell(RowNo, 9));

            Evaluate(SOImportBuffer."YearofPassing", GetValueAtCell(RowNo, 10));

               Evaluate(SOImportBuffer."Specialization", GetValueAtCell(RowNo, 11));

               Evaluate(SOImportBuffer."Are you pursuing or have already completed your Post graduate degree", GetValueAtCell(RowNo, 12));

               Evaluate(SOImportBuffer."If Other , Please name your College", GetValueAtCell(RowNo, 13));

               Evaluate(SOImportBuffer."Address", GetValueAtCell(RowNo, 14));

               Evaluate(SOImportBuffer."Country", GetValueAtCell(RowNo, 15));

               Evaluate(SOImportBuffer."state", GetValueAtCell(RowNo, 16));

               Evaluate(SOImportBuffer."City", GetValueAtCell(RowNo, 17));

               Evaluate(SOImportBuffer."Zip Postal Code", GetValueAtCell(RowNo, 18));

               Evaluate(SOImportBuffer."UploadResume", GetValueAtCell(RowNo, 19));

               Evaluate(SOImportBuffer."Candidate Photo", GetValueAtCell(RowNo, 20));

               Evaluate(SOImportBuffer."Previous Work Experience, If any Specify", GetValueAtCell(RowNo, 21));

               Evaluate(SOImportBuffer."Work Designation", GetValueAtCell(RowNo, 22));

               Evaluate(SOImportBuffer."WorkDuration from", GetValueAtCell(RowNo, 23));

               Evaluate(SOImportBuffer."WorkDuration To", GetValueAtCell(RowNo, 24));

     end;

           Message(ExcelImportSucess);

       end;

       local procedure GetValueAtCell(RowNo: Integer; ColNo: Integer): Text

       begin

           TempExcelBuffer.Reset();

           If TempExcelBuffer.Get(RowNo, ColNo) then

               exit(TempExcelBuffer."Cell Value as Text")

           else

               exit('');

       end;

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,165 Moderator on at

    To me it looks like you are missing an SOImportBuffer.insert(true); you should put that after Evaluate(SOImportBuffer."WorkDuration To", GetValueAtCell(RowNo, 24));

  • Verified answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at

    Hi, Here's a simple example that hopefully will give you some hints.

    https://yzhums.com/4223/

    Thanks.

    ZHU

  • karthikeyani c Profile Picture
    190 on at

    Yes,

    I have tried but when I publish and run the project it's highlighting it.

    I'm not getting it done so..

  • karthikeyani c Profile Picture
    190 on at

    Yes,

    My coding was related to that. I have taken https://yzhums.com/4223/ this as reference and done it .

    But even though I can't able to get it done. Please help me out of this..

    Thanks.

  • Verified answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at

    Hi, I re-tested my code and it looks fine.

    Test video:

    View:/cfs-file/__key/communityserver-discussions-components-files/758/Test06281431.mp4:1024:768

    Source Code:

    embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:e9789ef4-5471-46ee-a01e-71fe5d063b8e:type=text&text=table%2050101%20%22SO%20Import%20Buffer%22%0D%0A%7B%0D%0A%20%20%20%20Caption%20%3D%20%27SO%20Import%20Buffer%27%3B%0D%0A%20%20%20%20fields%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20field%281%3B%20%22Batch%20Name%22%3B%20Code%5B10%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Batch%20Name%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%282%3B%20%22Line%20No.%22%3B%20Integer%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Line%20No.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Editable%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%283%3B%20%22File%20Name%22%3B%20Text%5B50%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27File%20Name%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Editable%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%284%3B%20%22Sheet%20Name%22%3B%20Text%5B30%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Sheet%20Name%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%285%3B%20%22Imported%20Date%22%3B%20Date%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Imported%20Date%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Editable%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%286%3B%20%22Imported%20Time%22%3B%20Time%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Imported%20Time%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Editable%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%287%3B%20%22Sell-to%20Customer%20No.%22%3B%20Code%5B20%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Sell-to%20Customer%20No.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20TableRelation%20%3D%20Customer%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%288%3B%20%22Document%20No.%22%3B%20Code%5B20%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Document%20No.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%289%3B%20%22Posting%20Date%22%3B%20Date%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Posting%20Date%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2810%3B%20%22Currency%20Code%22%3B%20Code%5B10%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Currency%20Code%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20TableRelation%20%3D%20Currency%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2811%3B%20%22Document%20Date%22%3B%20Date%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Document%20Date%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2812%3B%20%22External%20Document%20No.%22%3B%20Code%5B35%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27External%20Document%20No.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2813%3B%20Type%3B%20Enum%20%22Sales%20Line%20Type%22%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Type%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2814%3B%20%22No.%22%3B%20Code%5B20%5D%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27No.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2815%3B%20Quantity%3B%20Decimal%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Quantity%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DecimalPlaces%20%3D%200%20%3A%205%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20field%2816%3B%20%22Unit%20Price%22%3B%20Decimal%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Unit%20Price%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20AutoFormatType%20%3D%202%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20AutoFormatExpression%20%3D%20%22Currency%20Code%22%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20DataClassification%20%3D%20CustomerContent%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20keys%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20key%28Key1%3B%20%22Batch%20Name%22%2C%20%22Line%20No.%22%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A%0D%0Apage%2050102%20%22SO%20Import%20Worksheet%22%0D%0A%7B%0D%0A%20%20%20%20AutoSplitKey%20%3D%20true%3B%0D%0A%20%20%20%20Caption%20%3D%20%27SO%20Import%20Worksheet%27%3B%0D%0A%20%20%20%20DelayedInsert%20%3D%20true%3B%0D%0A%20%20%20%20InsertAllowed%20%3D%20false%3B%0D%0A%20%20%20%20ModifyAllowed%20%3D%20false%3B%0D%0A%20%20%20%20PageType%20%3D%20Worksheet%3B%0D%0A%20%20%20%20SaveValues%20%3D%20true%3B%0D%0A%20%20%20%20SourceTable%20%3D%20%22SO%20Import%20Buffer%22%3B%0D%0A%20%20%20%20SourceTableView%20%3D%20sorting%28%22Batch%20Name%22%2C%20%22Line%20No.%22%29%3B%0D%0A%20%20%20%20UsageCategory%20%3D%20Tasks%3B%0D%0A%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20layout%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20area%28content%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20field%28BatchName%3B%20BatchName%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27Batch%20Name%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20repeater%28Group%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Editable%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Batch%20Name%22%3B%20Rec.%22Batch%20Name%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Visible%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Line%20No.%22%3B%20Rec.%22Line%20No.%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Visible%20%3D%20false%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Document%20No.%22%3B%20Rec.%22Document%20No.%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Sell-to%20Customer%20No.%22%3B%20Rec.%22Sell-to%20Customer%20No.%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Posting%20Date%22%3B%20Rec.%22Posting%20Date%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Currency%20Code%22%3B%20Rec.%22Currency%20Code%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Document%20Date%22%3B%20Rec.%22Document%20Date%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22External%20Document%20No.%22%3B%20Rec.%22External%20Document%20No.%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28Type%3B%20Rec.Type%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22No.%22%3B%20Rec.%22No.%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28Quantity%3B%20Rec.Quantity%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Unit%20Price%22%3B%20Rec.%22Unit%20Price%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22File%20Name%22%3B%20Rec.%22File%20Name%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Sheet%20Name%22%3B%20Rec.%22Sheet%20Name%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Imported%20Date%22%3B%20Rec.%22Imported%20Date%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20field%28%22Imported%20Time%22%3B%20Rec.%22Imported%20Time%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20actions%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20area%28processing%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20action%28%22%26Import%22%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Caption%20%3D%20%27%26Import%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Image%20%3D%20ImportExcel%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Promoted%20%3D%20true%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20PromotedCategory%20%3D%20Process%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ApplicationArea%20%3D%20All%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ToolTip%20%3D%20%27Import%20data%20from%20excel.%27%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20trigger%20OnAction%28%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20begin%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20BatchName%20%3D%20%27%27%20then%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Error%28BatchISBlankMsg%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ReadExcelSheet%28%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ImportExcelData%28%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20end%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20var%0D%0A%20%20%20%20%20%20%20%20BatchName%3A%20Code%5B10%5D%3B%0D%0A%20%20%20%20%20%20%20%20FileName%3A%20Text%5B100%5D%3B%0D%0A%20%20%20%20%20%20%20%20SheetName%3A%20Text%5B100%5D%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer%3A%20Record%20%22Excel%20Buffer%22%20temporary%3B%0D%0A%20%20%20%20%20%20%20%20UploadExcelMsg%3A%20Label%20%27Please%20Choose%20the%20Excel%20file.%27%3B%0D%0A%20%20%20%20%20%20%20%20NoFileFoundMsg%3A%20Label%20%27No%20Excel%20file%20found%21%27%3B%0D%0A%20%20%20%20%20%20%20%20BatchISBlankMsg%3A%20Label%20%27Batch%20name%20is%20blank%27%3B%0D%0A%20%20%20%20%20%20%20%20ExcelImportSucess%3A%20Label%20%27Excel%20is%20successfully%20imported.%27%3B%0D%0A%0D%0A%20%20%20%20local%20procedure%20ReadExcelSheet%28%29%0D%0A%20%20%20%20var%0D%0A%20%20%20%20%20%20%20%20FileMgt%3A%20Codeunit%20%22File%20Management%22%3B%0D%0A%20%20%20%20%20%20%20%20IStream%3A%20InStream%3B%0D%0A%20%20%20%20%20%20%20%20FromFile%3A%20Text%5B100%5D%3B%0D%0A%20%20%20%20begin%0D%0A%20%20%20%20%20%20%20%20UploadIntoStream%28UploadExcelMsg%2C%20%27%27%2C%20%27%27%2C%20FromFile%2C%20IStream%29%3B%0D%0A%20%20%20%20%20%20%20%20if%20FromFile%20%3C%3E%20%27%27%20then%20begin%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20FileName%20%3A%3D%20FileMgt.GetFileName%28FromFile%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SheetName%20%3A%3D%20TempExcelBuffer.SelectSheetsNameStream%28IStream%29%3B%0D%0A%20%20%20%20%20%20%20%20end%20else%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Error%28NoFileFoundMsg%29%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.Reset%28%29%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.DeleteAll%28%29%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.OpenBookStream%28IStream%2C%20SheetName%29%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.ReadSheet%28%29%3B%0D%0A%20%20%20%20end%3B%0D%0A%0D%0A%20%20%20%20local%20procedure%20ImportExcelData%28%29%0D%0A%20%20%20%20var%0D%0A%20%20%20%20%20%20%20%20SOImportBuffer%3A%20Record%20%22SO%20Import%20Buffer%22%3B%0D%0A%20%20%20%20%20%20%20%20RowNo%3A%20Integer%3B%0D%0A%20%20%20%20%20%20%20%20ColNo%3A%20Integer%3B%0D%0A%20%20%20%20%20%20%20%20LineNo%3A%20Integer%3B%0D%0A%20%20%20%20%20%20%20%20MaxRowNo%3A%20Integer%3B%0D%0A%20%20%20%20begin%0D%0A%20%20%20%20%20%20%20%20RowNo%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20ColNo%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20MaxRowNo%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20LineNo%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20SOImportBuffer.Reset%28%29%3B%0D%0A%20%20%20%20%20%20%20%20if%20SOImportBuffer.FindLast%28%29%20then%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20LineNo%20%3A%3D%20SOImportBuffer.%22Line%20No.%22%3B%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.Reset%28%29%3B%0D%0A%20%20%20%20%20%20%20%20if%20TempExcelBuffer.FindLast%28%29%20then%20begin%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20MaxRowNo%20%3A%3D%20TempExcelBuffer.%22Row%20No.%22%3B%0D%0A%20%20%20%20%20%20%20%20end%3B%0D%0A%20%20%20%20%20%20%20%20for%20RowNo%20%3A%3D%202%20to%20MaxRowNo%20do%20begin%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20LineNo%20%3A%3D%20LineNo%20%2B%2010000%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.Init%28%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Batch%20Name%22%2C%20BatchName%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.%22Line%20No.%22%20%3A%3D%20LineNo%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Document%20No.%22%2C%20GetValueAtCell%28RowNo%2C%201%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Sell-to%20Customer%20No.%22%2C%20GetValueAtCell%28RowNo%2C%202%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Posting%20Date%22%2C%20GetValueAtCell%28RowNo%2C%203%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Currency%20Code%22%2C%20GetValueAtCell%28RowNo%2C%204%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Document%20Date%22%2C%20GetValueAtCell%28RowNo%2C%205%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22External%20Document%20No.%22%2C%20GetValueAtCell%28RowNo%2C%206%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.Type%2C%20GetValueAtCell%28RowNo%2C%207%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22No.%22%2C%20GetValueAtCell%28RowNo%2C%208%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.Quantity%2C%20GetValueAtCell%28RowNo%2C%209%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Evaluate%28SOImportBuffer.%22Unit%20Price%22%2C%20GetValueAtCell%28RowNo%2C%2010%29%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.%22Sheet%20Name%22%20%3A%3D%20SheetName%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.%22File%20Name%22%20%3A%3D%20FileName%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.%22Imported%20Date%22%20%3A%3D%20Today%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.%22Imported%20Time%22%20%3A%3D%20Time%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20SOImportBuffer.Insert%28%29%3B%0D%0A%20%20%20%20%20%20%20%20end%3B%0D%0A%20%20%20%20%20%20%20%20Message%28ExcelImportSucess%29%3B%0D%0A%20%20%20%20end%3B%0D%0A%0D%0A%20%20%20%20local%20procedure%20GetValueAtCell%28RowNo%3A%20Integer%3B%20ColNo%3A%20Integer%29%3A%20Text%0D%0A%20%20%20%20begin%0D%0A%20%20%20%20%20%20%20%20TempExcelBuffer.Reset%28%29%3B%0D%0A%20%20%20%20%20%20%20%20If%20TempExcelBuffer.Get%28RowNo%2C%20ColNo%29%20then%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20exit%28TempExcelBuffer.%22Cell%20Value%20as%20Text%22%29%0D%0A%20%20%20%20%20%20%20%20else%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20exit%28%27%27%29%3B%0D%0A%20%20%20%20end%3B%0D%0A%7D

    Test Excel File:

    TestImport-01.xlsx

    Hope this helps.

    Thanks.

    ZHU

  • karthikeyani c Profile Picture
    190 on at

    Yeah That's Fine.

    This get worked.

    Is that also suits with list page instead of Worksheets.

    Thanks.

  • Verified answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at

    Of course, just modify it a little.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans