Issue with Import Excel to Cloud BC Table and Solution

 Author: Fazle Hasan

December 22, 2022


I was trying to import some records to a Cloud BC table from Excel.

 

I could not use these following Methods in Cloud BC, which was good for on-premises BC.

This is due to the scope of the methods (onPremise vs Cloud).


  ServerFileName := FileMgt.UploadFile(WindowTitle : Text[50];ClientFileName : Text);


  SheetName := ExcelBuf.SelectSheetsName(ServerFileName);


  ExcelBuf.OpenBook(ServerFileName,SheetName);


Instead I had to use different methods for Cloud:


  ServerFileName := FileMgt.BLOBImportWithFilter(var TempBlob: Codeunit "Temp Blob"; DialogCaption: Text; Name: Text; FileFilter: Text; ExtFilter: Text);


  FileStrm := TempBlob.CreateInStream();


  SheetName := ExcelBuf.SelectSheetsNameStream(FileStrm);

  

  ExcelBuf.OpenBookStream(FileStrm, SheetName);

Comments