â– pywin32.nurse3 is a sample.
â– The Excel processing system called pywin32 is incorporated.
â– This processing system is a library to run the main body of Excel.
â– The actual Excel processing is done by Excel itself, so there is no need to worry about divergence in behavior due to differences in processing systems, which is the biggest advantage.

The disadvantage is that it is slow. â– The disadvantage is that it is slow. It is not suitable for processing large amounts of data.

import win32com.client
#from win32com.client import constants as c

xl = win32com.client.Dispatch("Excel.Application")#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').FormulaR1C1 = 4
ws.Range('B3').FormulaR1C1 = 5
ws.Range('B4').FormulaR1C1 = 6

ch = ws.Shapes.AddChart().Select()

xl.ActiveChart.ChartType = 74 #win32com.client.constants.xlXYScatterLines
xl.ActiveChart.SetSourceData(Source=ws.Range("A1:B4"))