更新时间:2023-11-25 12:19:04
我已经修改了我作为问题给出的代码,并得到了我真正需要的,
I have modified the code I gave as a question and have got what I needed actually,
def getSheetName(file_name):
pointSheetObj = []
import xlrd as xl
TeamPointWorkbook = xl.open_workbook(file_name)
pointSheets = TeamPointWorkbook.sheet_names()
for i in pointSheets:
pointSheetObj.append(tuple((TeamPointWorkbook.sheet_by_name(i),i)))
所以如果列表(tuple
)pointSheetObj
被迭代,我们在tuple 的
在 index 1
处有工作表的名称pointSheetObj
内.
so if the list (of tuple
) pointSheetObj
is iterated we have name of the sheet at index 1
of the tuple
inside the pointSheetObj
.
通过这样做,我获得了名称和工作表对象,我可以用它来继续使用其他与工作表相关的方法.
By doing this I have got the name and the worksheet object with which I can carry on with other sheet related methods.