Back

Archive file cannot be size 0

Published: Mar 13, 2023
Post Author Written by Pat Roth

I’m using SmartConnect 21 and trying to connect to an Excel source file map and running into this error:

An error occurred retrieving the Excel file sheets: Archive file cannot be size 0.

I’ve also seen the same error one other time when the user trying to pull up an existing map where the data source was already created.


Archive file cannot be size 0.

Pressing View Details shows the stack trace and error:

System.IO.FileFormatException: -2146233033 Archive file cannot be size 0.
Stack:{
at MS.Internal.IO.Zip.ZipArchive.OpenOnStream(Stream stream, FileMode mode, FileAccess access, Boolean streaming)
at eOne.SmartConnect.Engine.RoutineHelper.PopulateLookupEditWithExcelSheets(LookUpEdit control, String excelFile, ExcelType excelFileVestion, Boolean throwExceptionsOnParametersNotSet, FtpHelper ftpHelper)
at eOne.SmartConnect.Connectors.Generic.FormExcelDataSource.lookVersion_TextChanged(Object sender, EventArgs e)
at DevExpress.XtraEditors.TextEdit.OnTextChanged(EventArgs e)
at DevExpress.XtraEditors.TextEdit.OnEditValueChanged()
at DevExpress.XtraEditors.PopupBaseEdit.OnEditValueChanged()
at DevExpress.XtraEditors.LookUpEdit.OnEditValueChanged()
at DevExpress.XtraEditors.BaseEdit.OnEditValueChanging(ChangingEventArgs e)
at DevExpress.XtraEditors.LookUpEdit.OnEditValueChanging(ChangingEventArgs e)
at DevExpress.XtraEditors.BaseEdit.set_EditValue(Object value)

at eOne.SmartConnect.Connectors.Generic.FormExcelDataSource.ShowExisting()
at eOne.SmartConnect.Engine.FormHelper.RunMethodWrapped(Action methodDelegate, String action)
}


While the solutions for both these issues appears different, it is essentially for the same reason.

Excel XLSX files are essentially “compressed data source” files meaning that the xlsx file is essentially a “zip” file with compressed data structures in the file.
In order to read that data, I believe that the file has to be extracted (at least temporarily) to be read.
In the first case in the Data Source Setup: Microsoft Excel window, the customer.xlsx Excel file is at the root of the C drive.

While clearly the user was able to drop the file to the root of the “C” drive as in this case, Windows sometimes is protective of applications to be able to write to that same “root” C drive.  In this case, SmartConnect is able to see the files on that drive but using this method to open the file to read the available sheets fails due to not being able to write back to that same root directory.

In the second case where the data source was successfully created but failed when a second user tried to use the map – that path was actually a UNC path and not a “root drive” like the first one (sorry, no screenshot for the path verifying this).  Instead, the user trying to open the existing map had READ permissions to that folder but didn’t have WRITE permissions to that same folder.  Because of the missing permissions, the method call wasn’t able to write back to that folder and we end up with the same error from the SmartConnect side.

The resolution to this was to grant the user trying to run the map READ & WRITE permissions to that network share and resolved the error in SmartConnect.

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.