skip to Main Content

Hello I am new to coding and I am trying to open an excel file. I’ve install the module for openpyxl and I know have at least somewhere because every time I type in command prompt pip install openpyxl it says it exists. But when I try to use it in my visual studio code it doesn’t seem to be recognizing it. I know this is probably a rookie mistake and something super simple to fix but any help is greatly appreciated.
enter image description here

I was just trying to see if I could write to it but I am cautious before proceeding with my code, thank you again.

2

Answers


  1. Test by creating a virtual environment,there you will be able to make better use of the versions of each library.

    https://docs.python.org/es/3/tutorial/venv.html

    however, I recommend that you use pandas to read your excel file. (pip install pandas)

    import pandas as pd
    df = pd.DataFrame(pd.read_excel(file directory)
    
    Login or Signup to reply.
  2. If use the shortcut Ctrl+Shift+p in Visual studio code and Select interpreter, Then select the version of python you want to use, Then open a terminal in visual studio code and type> pip freeze into the terminal and you will be able to see if openpyxl is installed, Hope this helps.
    enter image description here
    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search