openpyxl Library in Python:
Openpyxl is a Python library for reading and writing Excel files with the xlsx, xlsm, xltx, and xltm extensions. It comes with a number of different modules that allow you to work with Excel files without having to use any third-party software.
Let us use the Python package manager pip to install the openpyxl module here. The pip package manager supports in the installation and management of additional Python packages that are not included in the standard library.
Installation:
pip install package_name
Output:
Collecting package_name Downloading package_name-0.1.tar.gz (782 bytes) Building wheels for collected packages: package-name Building wheel for package-name (setup.py) ... done Created wheel for package-name: filename=package_name-0.1-py3-none-any.whl size=1254 sha256=5704546ee196cfea91be74986fddb721d38e9f6063d138b8e1eb00d6f7b3699b Stored in directory: /root/.cache/pip/wheels/aa/56/2f/2bf8ec875b1c71660b2692b4aab073132abc 78ac076140489b Successfully built package-name Installing collected packages: package-name Successfully installed package-name-0.1
Installation of openpyxl in windows
Open the command prompt and type the below command for the installation of the openpyxl package.
pip install openpyxl
Output:
Collecting openpyxl Downloading openpyxl-3.0.9-py2.py3-none-any.whl (242 kB) |████████████████████████████████| 242 kB 1.6 MB/s Collecting et-xmlfile Downloading et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB) Installing collected packages: et-xmlfile, openpyxl Successfully installed et-xmlfile-1.1.0 openpyxl-3.0.9
The openpyxl package is installed successfully on your Windows system
Another Way to Install openpyxl Library in Windows
We can install the openpyxl package using the pip package manager; however, if the above technique fails to install the package, we may still install the package manually from the official website on Windows.
Steps to be followed:
- To install the Mahotas package, go to the official website (https://pypi.org/project/openpyxl/)
- Navigate to the Download Files option and click on the openpyxl openpyxl.x.x.x.tar.gz file link to download the openpyxl package. (The version number of the package is denoted by x.x.x here)
- Go to the Downloads folder and extract the openpyxl TAR file there.
- The package should be extracted to the Python folder which is on the C:\ disk.
- Set the path to the extracted openpyxl package file in the CMDÂ terminal to modify the directory.
- Finally, for package installation, run the setup file contained within the openpyxl package file.
py setup.py install
Output:
Installation of functools32 Library in Linux
We may also use the pip package manager to install the openpyxl package on a Linux system.
Steps to be followed:
- Open the Linux terminal using Ctrl+Alt+TÂ
- Type the below pip command for the installation of the openpyxl library.
$ sudo pip install openpyxl
The package openpyxl was successfully installed on the Linux system.
Installation of functools32 Library using conda
Use the below command to install the openpyxl package using conda:
conda install -c anaconda openpyxl