Loading excel workbook from sharepoint

Hi all,

we allow customers to load excel workbooks from ‘internet’ as well (such as sharepoint etc).
Now they get the following error:

Message: "The given path's format is not supported."
Source: "mscorlib"
StackTrace: "   at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)" & vbCrLf & "   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)" & vbCrLf & "   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)" & vbCrLf & "   at GemBox.Spreadsheet.LoadOptions." & ChrW(2) & "(ExcelFile " & ChrW(2) & ", Stream " & ChrW(3) & ", String " & ChrW(5) & ", Boolean " & vbBack & ")" & vbCrLf & "   at GemBox.Spreadsheet.LoadOptions." & ChrW(3) & "(String " & ChrW(2) & ")" & vbCrLf & " 

The line the error occurs is: gmWorkbook0 = ExcelFile.Load(filename)
where filename is “https://xxxxxxxxxxxxxxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Documents/yyyyyyyyyyyy/workbookfilename.xlsm

thanks in advance.
Arie

Hi Arie,

Can you try this:

Dim response = System.Net.WebRequest.Create(filename).GetResponse()
Dim responseStream = response.GetResponseStream()
            
Dim inputStream As New MemoryStream()
responseStream.CopyTo(inputStream);

Dim gmWorkbook0 = ExcelFile.Load(inputStream, LoadOptions.XlsxDefault)

inputStream.Dispose()
responseStream.Dispose()
response.Dispose()

' TODO, use your gmWorkbook0 object as needed...

If this works for you, please let me know and we’ll add direct support for this URL call in the ExcelFile.Load method.

Regards,
Mario