C
C#5mo ago
Nemesis

✅ RPC not available on trying to read a Excel workbook using interop

I was trying to use Microsoft.Office.Interop.Excel to open a excel file and read its content. but I get "RPC not available" error on Excel.Application.Workbooks.Open and Excel.Application.Quit any idea what could be going wrong? No extra Add ins. Excel works fine manually.
13 Replies
Raven Scarlet
Raven Scarlet5mo ago
Have you tried opening excel in your local machine?
Nemesis
Nemesis5mo ago
yes, excel opens up fine in the machine
Raven Scarlet
Raven Scarlet5mo ago
Which dotnet version? Can I see the code?
Nemesis
Nemesis5mo ago
.net framework 4.6.2
Excel.Application excelApp = excelReferenceInstance.GetExcelReference(); ;
var excelWorkbook = excelApp.Workbooks.Open(Filename: localFilepath,
UpdateLinks: 0, // External reference (links) will not be updated when workbook is opened
ReadOnly: true,
Format: 5, // No delimiter because not opening a text file
Password: "",
WriteResPassword: "",
IgnoreReadOnlyRecommended: true,
Delimiter: null,
Editable: false,
Notify: false,
Converter: 0,
Local: true,
CorruptLoad: Excel.XlCorruptLoad.xlNormalLoad);
Excel.Application excelApp = excelReferenceInstance.GetExcelReference(); ;
var excelWorkbook = excelApp.Workbooks.Open(Filename: localFilepath,
UpdateLinks: 0, // External reference (links) will not be updated when workbook is opened
ReadOnly: true,
Format: 5, // No delimiter because not opening a text file
Password: "",
WriteResPassword: "",
IgnoreReadOnlyRecommended: true,
Delimiter: null,
Editable: false,
Notify: false,
Converter: 0,
Local: true,
CorruptLoad: Excel.XlCorruptLoad.xlNormalLoad);
Raven Scarlet
Raven Scarlet5mo ago
It's an odd problem I checked the internet but only could find info about Visual Basic At this point, I personally would optate for using a library To deal with excel files How are your possibilities?
Nemesis
Nemesis5mo ago
what are some recommended libraries for that? I have seen ClosedXML being recommended in many places
Raven Scarlet
Raven Scarlet5mo ago
I'd go for IronXL but not sure if it works on Framework Is it a new project? any chance on migrating to .NET 8?
Nemesis
Nemesis5mo ago
no, it is an old project. migrating will be lot of work since theres lot of code
Raven Scarlet
Raven Scarlet5mo ago
I see I checked and it supports Framework you may be fine with it
Nemesis
Nemesis5mo ago
thanks, will try that library out
Raven Scarlet
Raven Scarlet5mo ago
give a feedback for me to know if it worked
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View