Docker pandas read excel

  docker, excel, pandas, python, xlsx

I’m a new in Docker, and I need to run a Flask app, but in this app, I need to read a xlsx file.

When I build my docker image, I have the excel file but Docker don’t read it.

See the part of my code with the xlsx :

try :
    # Page PayPlug
    infos_pay = pd.read_excel('./app-infos.xlsx', sheet_name='payplug')
    secret_key = infos_pay.loc[0].tolist()
    payplug.set_secret_key(secret_key[0])
    # Page mail
    feuille_mail = pd.read_excel('./app-infos.xlsx', sheet_name='mail')
    infos_mail = feuille_mail.loc[0].tolist()
    
except :
    print("Can't read file")

And my docker file :

FROM python:3.8

WORKDIR /code

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .

CMD [ "python", "./web_AuSpot.py" ]

When I use ls cmd in the cli of the image, I see the xlsx file, so why pandas can’t read it ?

Thank you, I hope my explanation is clear.

Source: Docker Questions

LEAVE A COMMENT