Chapter 26. Storing data—not in Excel!
PowerShell can programmatically create and update Excel documents. You can also jump off the roof of your house into a pile of sharp glass. But just because you can do those things, doesn’t mean you should do them. Excel isn’t a database, and it pains us to see people struggling to use it as one. Programming against Excel, in PowerShell, requires you to use the Microsoft Office Programmability components, which are added into .NET when you install Office. Those components, in turn, use a decade-old Component Object Model (COM) interface that Microsoft hasn’t updated in, well, ever. We cry when we see administrators write scripts that literally include hundreds of lines of Excel-related code. It’s time consuming, frustrating, and wasteful. Please don’t do it.
But you will need to store data someplace, some time. That’s fine. There’s a better way.