A very personal blog

I’m so tired

Urgh I’ve been pulling my hair out trying to make this PowerShell module to work but it just won’t run consistently! Module in question is dfinke/ImportExcel. My problem is I’ve been getting the error

Unable to find type [OfficeOpenXml.ExcelPackage]

randomly a lot which has prompted me to do several things which sometimes work and sometimes won’t. What I’ve been doing every time that appears is reinstall a different version of ImportExcel, which fixes the problem but every time I log off and get back to work the following day I’m fucking faced with the same error. Beats me why! I’m looking at a more permanent fix because obviously I can’t keep reinstalling forever…

For added info here’s how I do a reinstall…

I open Windows Powershell as admin
Uninstall-Module ImportExcel until I get a No match was found, then…
Install-Module -Name ImportExcel -RequiredVersion 7.8.4 or whatever version

Usually a reinstall gets it fixed… but still… I don’t know why I keep getting the damned error. I’ve read it has something to do with EPPlus.dll not getting loaded properly but seeing that it worked last night and then decided not to the next day is just so weird to me.