com-automation

Using PasteExcelTable to copy Excel data to the body of an Outlook email with Python

…衆ロ難τιáo~ 提交于 2020-05-16 01:20:10
问题 Formatted Excel range copied to a Word file This copies a range of cells from Excel and pastes them into a Word document with formatting preserved. The code works for this. However, I also want to paste the data into the body of an email with the cell styles. import sys from pathlib import Path import win32com.client as win32 excel_path = str(Path.cwd() / 'input.xlsx') excel = win32.gencache.EnsureDispatch('Excel.Application') excel.Visible = False excel.DisplayAlerts = False wb = excel