win32打印工作表

1
2
3
4
5
6
7
8
9
10
11
import win32com.client as win32

excel = win32.gencache.EnsureDispatch('Excel.Application')

wb = excel.Workbooks.Open(r'C:\123.xlsx')
ws = wb.Sheets('Sheet1')

ws.PrintOut()

wb.Close(False)
excel.Quit()