Pages

Friday, June 29, 2018

Extracting Email Addresses From Many Excel Spreadsheets

I need to extract the email addresses from several hundred Excel spreadsheets.  This is a one-time operation.  There are programs out there that do this, but running an exe file from an unknown source seems risky.  If Excel files were text and this was Linux, I would do an egrep.

There is a Power Shell script that does what I need.  But when I run it, "execution of scripts is disabled on this system."

Making progress.  "Unable to find type [Microsoft.Office.Interop.Excel.XlFileFormat]\ make sure that the assembly containing this type is loaded"

In PowerShell:
Add-Type -AssemblyName Microsoft.Office.Interop.Excel

CSV files being created now.

2 comments:

  1. I was going to say that Python and Perl both have Excel modules. I've used the former and it's...useful, if a bit arcane.

    ReplyDelete
  2. Add a printer. The secret trick is that Windows still has the 'Generic / Text Only' printer built-in. Install that set to print to a file and you can turn anything into a text file.

    ReplyDelete