getting sheet names from openpyxl

后端 未结 3 1028
天命终不由人
天命终不由人 2021-01-31 07:55

I have a moderately large xlsx file (around 14 MB) and OpenOffice hangs trying to open it. I was trying to use openpyxl to read the content, following this tutorial. The code sn

3条回答
  •  感情败类
    2021-01-31 08:36

    As mentioned the earlier answer you can get the list of sheet names by using the ws.sheetnames

    But if you know the sheet names you can get that worksheet object by

    ws.get_sheet_by_name("YOUR_SHEET_NAME")
    

    Another way of doing this is as mentioned in earlier answer

    ws['YOUR_SHEET_NAME']
    

提交回复
热议问题