How to reference Excel table column names in XLWings?

前端 未结 1 1206
死守一世寂寞
死守一世寂寞 2021-01-22 17:40

Does XLWings allow my to interact with Excel tables (available in Excel 2007 and later via menu or ctrl+t) by table and column names? This does exist in the young, open sourcep

相关标签:
1条回答
  • 2021-01-22 18:22

    Square bracket access works, see e.g. here:

    For example to get the data of a specific column:

    import xlwings as xw
    wb = xw.Workbook.active()
    xw.Range('TableName[ColumnName]').value
    

    Or to get the column including header and Total row, you could do:

    xw.Range('TableName[[#All], [ColumnName]]').value
    
    0 讨论(0)
提交回复
热议问题