How To Reference Multiple Cell Ranges at Once Using xlwings?

Method

#xlwings

sht[‘A2, B3:C8, E2:F5’].select()    #Reference multiple cell ranges

#sht.range(‘A2, B3:C8, E2:F5’).select()

 

#xlwings API

#sht.api.Range(‘A2, B3:C8, E2:F5’).Select()

Sample Code

#Reference multiple cell ranges at once

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['A2, B3:C8, E2:F5'].select()    #Reference multiple cell ranges
#sht.range('A2, B3:C8, E2:F5').select()

#xlwings API
#sht.api.Range('A2, B3:C8, E2:F5').Select()

#bk.close()
#app.kill()
Reference Multiple Cell Ranges at Once Using xlwings
January 31, 2026 (0)


Leave a Reply

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