Parsing Email Headers from an MBOX file

When analyzing email headers from an MBOX file, a Python script like those below is useful to pull out the fields of interest. The first script below exports the data as a pipe-delimited file, whereas the second (similar) program will export the results to an Excel file (.xlsx).

First example (pipe-delimited):

Second Example (Excel format):