Python, Excel, and Charts using win32com
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Python and MS Excel question - using win32com, I'm able to create a chart within Excel but i'm unable to move it within a worksheet. I've found code online to generate the chart: import win32com.client from win32com.client import constants as c xl = win32com.client.gencache.EnsureDispatch('Excel.Application') xl.Visible = True wb = xl.Workbooks.Add() ws = xl.ActiveSheet ws.Range('A1').FormulaR1C1 = 'X' ws.Range('B1').FormulaR1C1 = 'Y' ws.Range('A2').FormulaR1C1 = 1 ws.Range('A3').FormulaR1C1 = 2 ws.Range('A4').FormulaR1C1 = 3 ws.Range('B2')