I'm using win32com to fill out an Excel spreadsheet with some analytic information. I have a cell that I want to be in this form:
This is the problem description: this is the command you run to fix it
I can't seem to figure out how to get the text into the cell with Python with mixed formatting.
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Add()
ws = wb.Worksheets("Sheet1")
excel.Visible=True
sel = excel.Selection
sel.Value = "this is the command you run to fix it"
sel.Font.Bold = True
ws.Cells(1,1).Value = 'This is the problem description' + sel.Value #makes the whole cell bold
ws.Cells(1,1).Value = "{} {}".format("this is the problem desc",sel) #makes the whole cell bold
The selection object has a Characters attribute, but I can't find any documentation on what it does.