1

I have a .xls Excel file and know the VBA CodeName property for the sheet I want to read. How can I read the sheet into Python by using the Sheet's CodeName property, rather than it's Name property?

Topic discussing the difference between VBA CodeName and Name: Excel tab sheet names vs. Visual Basic sheet names

Community
  • 1
  • 1
Nick D
  • 430
  • 1
  • 4
  • 11

1 Answers1

-1
#you have to install the module
#import the xlrd module
import xlrd
workbook = xlrd.open("example.xls") #it can take x|xs|xls format
#if you know the name of the sheet use
sheet = workbook.sheet_by_name("name of the sheet")
#or you can use index number
sheet = workbook.sheet_by_index("index of the sheet here")
#you can print the cell you want like this
print(" print from the 4th row 2nd cell".format(sheet(4,2).value))

if this was helpful give it a like if not i don't understand english well thankyou and i am new

  • 2
    This only shows how to access the sheet by its name or index, not by its `CodeName`. (E.g. a sheet's `CodeName` might be `shtInputData`, its `Name` might be `"Input"`, and its index might be `3`.) – YowE3K Feb 17 '17 at 01:25