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;