Open In App

How to Install openpyxl in python on windows

Last Updated : 07 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

It is common for data frames to be stored in excel files or as .csv files. Therefore, it is required for most programming languages to be equipped with utilities that allow the user to process such files. Openpyxl is a Python library for reading and writing Excel files with extensions like xlsx, xlsm, xltx, xltm. It provides different modules to process Excel files without involving any other third-party software. This article will teach you how to install the openpyxl library in Python on Windows Operating System. 

Installing openpyxl in Python

We can install openpyxl on Windows via 2 different methods.

  • Installing using PIP Manager
  • Installing using the official package 

Method 1: Installing using PIP Manager

Step 1: Open the start menu by pressing the [Win] key or clicking the bottom left section of the desktop

Start > Windows Ease of Access

 

Step 2: Type cmd in the menu. Results similar to the following would have appeared

cmd

 

Step 3: Select the cmd app from the suggestions and click on Run as administrator.

 

Step 4: A new window would have appeared similar to this

 

Step 5: Type the following command and press Enter.

py -m pip install openpyxl

 

Now the openpyxl library has been successfully installed in your Python distribution.

Method 2: Installing using the official package

Another way of installing openpyxl on your python distribution is by downloading the package from their site and installing it manually. 

Step 1: Open the download page for openpyxl from the following link.

https://pypi.org/project/openpyxl/#files

 

Step 2: Click on the source distribution link. 

 

Step 3: The download would have started.

 

Step 4: Now go to the path where the file has been downloaded, right-click the file and select the option extract here.

 

Step 5: When the process of extraction of files has been completed, a directory similar to this would have appeared.

 

The directory would contain the following files

 

Step 6: Now open cmd.exe and change the current working directory to the path of this directory:

 

Step 7: Now enter the following command:

py setup.py install

 

Upon completion of the command, openpyxl would be installed in your python distribution.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads