I have a mystery as to why one type of excel file will decode but the other will not. Here is what the two different files come in as:
The only difference that I can see is that one comes in with _content data.
Here's the code I run to try and make a local excel file based on this information:
for msg in email_from_radar:
for attachment in msg.attachments:
fpath = os.path.abspath(table_id + '.xlsx')
with open(fpath, 'wb') as f:
f.write(attachment.content)
break
break
essentially I'm just naming a path for the file then trying to write the excel file to that path. The only thing I can think of is that the file that doesn't work is much smaller.