'How to make python read multiple sheets on an excel file one by one

Stackoverflow

Hi python noob here. I been learning python for couple of weeks so I don’t know if this is possible or even super easy. I have an excel files with o lot of sheets, I have managed to create a python code that do all the changes I need to make on a single sheet and then saves it. I just need to type the sheet name run it then type another sheet name and run it again etc … Is there a way to make the code so it does all the sheets one by one when I run it? I was thinking about creating a list with all the sheets name and using a loop but not sure how… thank you.



Solution 1:[1]

Use openpyxl module. You have the list of sheets in openpyxl object, so you can run over sheets as by list. You could find the solutions of similar problem here:

getting sheet names from openpyxl

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt