I'm trying to change the size of a chart in an Excel spreadsheet using win32com and Python. The code below takes an Excel file that is already populated with data, and adds a chart which I would like to resize. Any ideas on code to add\modify to change the size of the chart? Thanks!
import win32com.client as win32
xl = win32.DispatchEx('Excel.Application')
wb = xl.Workbooks.Open('C:/newfolder/example.xlsx')
ws = wb.Worksheets('Sheet1').Select()
ws = xl.ActiveSheet
ch = ws.Shapes.AddChart().Select()
xl.ActiveChart.ChartType = c.xlXYScatterLines
xl.ActiveChart.SetSourceData(Source = ws.Range(a+':'+b),PlotBy =2)
xl.ActiveChart.HasTitle = True
xl.ActiveChart.ChartTitle.Text = 'Chart of Capabilities'
xl.ActiveChart.ChartTitle.Font.Size = 14
.
.
.
{changing various chart attriutes}
.
.
.
Yous should try openpyxl library
Also you can specify the size at the time of creation expression.AddChart(Type, Left, Top, Width, Height).