xlwings: Referencing Cells by Name

xlwings code:

#Referencing by Cell Name

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
cl=sht.cells(3,3)
cl.name='test'    #Setting the cell name
sht.range('test').select()    #Referencing the cell by it's name

#xlwings API
#cl=sht.api.Range('C3')
#cl.Name='test'
#sht.api.Range('test').Select()

#bk.close()
#app.kill()


category : xlwings: Object Model

Leave a Reply

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

Zoomed Image