C
C#11mo 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
✿ Scarlet ✿
✿ Scarlet ✿11mo ago
Have you tried opening excel in your local machine?
Nemesis
NemesisOP11mo ago
yes, excel opens up fine in the machine
✿ Scarlet ✿
✿ Scarlet ✿11mo ago
Which dotnet version? Can I see the code?
Nemesis
NemesisOP11mo 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);
✿ Scarlet ✿
✿ Scarlet ✿11mo 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
NemesisOP11mo ago
what are some recommended libraries for that? I have seen ClosedXML being recommended in many places
✿ Scarlet ✿
✿ Scarlet ✿11mo 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
NemesisOP11mo ago
no, it is an old project. migrating will be lot of work since theres lot of code
✿ Scarlet ✿
✿ Scarlet ✿11mo ago
I see I checked and it supports Framework you may be fine with it
Nemesis
NemesisOP11mo ago
thanks, will try that library out
✿ Scarlet ✿
✿ Scarlet ✿11mo ago
give a feedback for me to know if it worked
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server