根据行号和列号通过xlwings将值放入Excel单元格

Place value into Excel cell through xlwings based on row number and column number

假设我想将值 123 放入对应于 row=1column=2 的 Excel 单元格 A2 中。我如何通过 xlwings 执行此操作?

我正在使用 xlwings 0.19.4,python 3.7,Excel 2016。

我会回答我自己的问题。

wb = xw.Book.caller()
sheet = wb.sheets[0]
row_num = 1
col_num = 2
sheet.range(row_num, col_num).value = 123