Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to add sales lines from an Excel file in NAV 2015

(1) ShareShare
ReportReport
Posted on by 99
Hello, 
 
I had previously developed the process in Business Central and tried to replicate it in NAV 2015. However, I encountered an issue because in that version, the 'SelectSheetsNameStream' function does not exist in the 'Excel Buffer' table. How can I read and import Excel records and insert them as sales lines?
 
This is the code in Business Central for reading the Excel file:
    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;
 
Thanks in advance.
  • isabtogumon Profile Picture
    99 on at
    How to add sales lines from an Excel file in NAV 2015
    Thank you YUN ZHU for your response.
     
    I have adapted the import process, and it has worked correctly. However, I have some questions that were not addressed; I hope you can clarify them.
     
    The first one is: how can I filter the dialog box to display only Excel files? I used this line 'ServerFileName := FileMgt.UploadFile(Text001,'Excel file(.xlsx)|.xlsx'');' but I get an error.
     
    The second question is if it's possible to control up to which column number I want to read, for example, if I have 70 rows in a sheet but only want to read from row 1 to row 50.
     
    Thanks in advance.
  • Suggested answer
    YUN ZHU Profile Picture
    83,822 Super User 2025 Season 1 on at
    How to add sales lines from an Excel file in NAV 2015

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans