"No module named 'openpyxl'." in deploment

I am experiencing an issue with my code, which runs perfectly on localhost:8501. However, upon deployment, I encounter an error stating “No module named ‘openpyxl’.” I would like to clarify that I do not utilize OpenPyXL for Excel operations. Could you please provide guidance on how to resolve this issue and successfully deploy my test application on the Streamlit server?

this is my coe
import streamlit as st
import pandas as pd

url = “student.xlsx - Google Sheets

file_id = url.split(“/”)[-2]
path1 = “https://drive.google.com/uc?export=download&id=” + file_id
sce = pd.read_excel(path1)
st.write(sce)

this is error
ModuleNotFoundError: No module named ‘openpyxl’
During handling of the above exception, another exception occurred:
────────────────────── Traceback (most recent call last)
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
nner/exec_code.py:88 in exec_func_with_error_handling
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
nner/script_runner.py:579 in code_to_exec
/mount/src/mdemo/stexcel.py:7 in
4 url = “https://docs.google.com/spreadsheets/d/1-6-dNTXR3YLAvRIDRWf9DQsdX
5 file_id = url.split(”/")[-2]
6 path1 = “https://drive.google.com/uc?export=download&id=” + file_id
❱ 7 sce = pd.read_excel(path1)
8 st.write(sce)
9
/home/adminuser/venv/lib/python3.12/site-packages/pandas/io/excel/_base.py:4
95 in read_excel


![error|622x500](upload://ygT0nGDimSlnLiW4OlBYmIO3Ux.png)

Add openpyxl to your requirements.txt.
Pandas needs this to read excel files

Thank you, sir, for your swift response. Following your instructions, I have added openxl to my requirements.txt file. However, upon attempting to deploy again, I encountered a new error related to the Python version. Please provide guidance on how to resolve this issue.
see error

ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11

ERROR: Could not find a version that satisfies the requirement pywin32==308 (from versions: none)

ERROR: No matching distribution found for pywin32==308
[notice] A new release of pip is available: 24.0 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
Checking if Streamlit is installed

pywin32 is a Windows specific library. Streamlit Community Cloud runs on Linux.
Remove it from your requirements.txt file.

Also, these are frequently asked and answered questions on the forum. Please search the forum for such issues before posting.