0

As a novice Python programmer I am trying to understand the syntax being used to reference a slice of a workbook or worksheet while using openpyxl. I am confused as to what the following snippet of code is actually referencing under the hood.

*****

import openpyxl

wb1 = openpyxl.Workbook()

ws1 = wb1['sheet'] <-- What is that reference syntax (text index?, dictionary, ?)

value = ws1['A1'] <-- Same as above

*****

Is it an index to an array (series or dataframe)?

Is it a reference to a Dictionary because it is using ["text"] as a reference?

I understand the outcome but not how this reference syntax works.

In a list I would reference an array like this - wb1[0] as the first sheet. But this references the index in "text".

I was expecting the Type to be a 'List' that I could use a numerical index reference. Or I was expecting the type to be a 'Dictionary' that I could use a "Text" reference.

DTM
  • 1
  • 2

0 Answers0