How To Reference Multiple Cells Using xlwings?

Method

#xlwings

sht.range(‘B2, C5, D7’).select()

#sht[‘B2, C5, D7’].select()

 

#xlwings API

#sht.api.Range(‘B2, C5, D7’).Select()

Sample Code

#Referencing Multiple Cells

import xlwings as xw    #Import the xlwings package

app=xw.App()
bk=app.books.active    #Get the active workbook
sht=bk.sheets.active    #Get the active worksheet

#xlwings
sht.range('B2, C5, D7').select()
#sht['B2, C5, D7'].select()

#xlwings API
#sht.api.Range('B2, C5, D7').Select()

#bk.close()
#app.kill()
Reference Multiple Cells Using xlwings

January 26, 2026 (0)


Leave a Reply

Your email address will not be published. Required fields are marked *