python send excel file script

To add MySQL query results to an email as an Excel file and send it to specified recipients, you can use Python的pandas和openpyxl库. The following is a sample script that executes a MySQL query and writes the results to "output.xlsx"an Excel file named . It will then add the Excel file as an attachment to the email and send it to the specified recipients:

import pandas as pd
import openpyxl
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text 

Guess you like

Origin blog.csdn.net/chj_1224365967/article/details/131171243
Recommended