Search code examples
pythonexcelxlwings

xlwings: make cell bold


I have seen that stylistic requests are to be implemented in xlwings.

Is there a workaround to make the content of a cell bold?


Solution

  • Since xlwings 0.23.0, this is now available natively:

    import xlwings as xw
    wb = xw.Book()
    wb.sheets[0].range('A1').font.bold = True
    

    For xlwings < 0.23.0, you can work around it like this:

    import xlwings as xw
    wb = xw.Book()
    wb.sheets[0].range('A1').api.Font.Bold = True