[Excel Package] Problem using Excel Package with the Office 365
excel-package
Web icon
Forge component by Carlos Alfaro
Application Type
Traditional Web

Hi Outsystems team,

I'm using the Excel Package component to manipulate an Excel template with macros, this template is manipulated to add other sheets inside it, to do this we call Server Action Workbook_AddCopyWorksheet passing as parameters the workbook, the name of the new sheet, and the worksheet that will be copied.

After making adjustments to the worksheet's Visual Basic code, enabling the macros, and saving, the Excel manipulation process works correctly using another different version of office 365, but when using Office 365 the following error message occurs in the Service Center: "Object reference not set to an instance of an object. "

Error Stack:

Object reference not set to an instance of an object.
at OfficeOpenXml.VBA.ExcelVbaProject.ReadProjectProperties()
at OfficeOpenXml.ExcelWorkbook.get_VbaProject()
at OfficeOpenXml.ExcelWorksheets.Add(String Name, ExcelWorksheet Copy)
at OutSystems.NssExcel_Package.CssExcel_Package.MssWorkbook_AddCopyWorksheet(Object ssWorkbook, String ssWorksheetName, Object ssWorksheetToCopy, Object& ssWorksheet)
   at ssContractManagement_BL.RssExtensionExcel_Package.MssWorkbook_AddCopyWorksheet(HeContext heContext, Object inParamWorkbook, String inParamWorksheetName, Object inParamWorksheetToCopy, Object& outParamWorksheet)


Does anyone know if the Excel Package component has any problem with Office 365?

Has anyone experienced this issue? And is there any workaround that can be done in this case?


Kind regards,

William Araújo

Hello @William Araújo 

The component uses EPPlus a .net library that reads and writes Excel files using the Open Office Xml format (xlsx). So let's make sure your file is not an xls file (old format) because that is not compatible with this component. 

So please confirm your file type/ extension.

Regards,

AJ

Hi @AJ. 

The file type I'm using is xlsm (Excel Macro-Enabled Workbook), because of the macros that exist in the Excel file.


Kind regards,

William Araújo

Thanks William. My bad I should have inferred that when you mentioned macros. 

Could you share a screenshot of the steps in your logic flow and which step this issue occurs at? It will help understand the sequence of steps involved in adding the worksheets to the excel workbook and identify what may be missing. For e.g. if a worksheet is not properly initialized before it is added could cause an error such as this.

Regards,

AJ

Hi @AJ. 

The problem occurs in the Workbook_AddCopyWorksheet action. As I reported earlier, this issue only occurs when the Excel file is saved in Office 365, using another version of Excel other than Office 365 the reported error does not occur.

Screenshot:


Kind regards,

William Araújo

Hi,

I have a similar issue with the same use case.

Any news?

Thank you.

Hi,

Have you found any solution for this scenario?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.