How To Read Particular Cell In Excel Using Python

In this tutorial, you will learn how to read a particular cell in an Excel file using Python programming.

Extracting specific cell data from Excel is necessary for tasks like data analysis, generating reports, or making calculations based on specific cell data.

We will be using the popular Python library openpyxl to accomplish this task. If you don’t have openpyxl installed already, you can install it using the following command:

Now let’s dive into the steps to read a particular cell in an Excel file.

Step 1: Import the required libraries

First, we need to import the required libraries. We will import the openpyxl library.

Step 2: Load the Excel file

To read an Excel file, we have to load the file first. We will use the load_workbook() function from the openpyxl library to load the Excel file.

Here, replace ‘sample.xlsx’ with the path to your Excel file.

Step 3: Select the Worksheet

After loading the workbook, we need to select the specific worksheet we want to read data from. We will use the method .get_sheet_by_name() to get the required sheet from the workbook.

Replace ‘Sheet1’ with the name of the sheet you want to access.

Step 4: Read the Cell Data

Finally, to read the data from a specific cell, we can use the .cell() method by passing the row and column index.

Replace ‘2’ and ‘3’ with the row and column indexes of the cell you want to read.

Full Code

Combine all the code snippets above into one script:

Example Excel File

For this tutorial, we used the following sample Excel file:

| A      | B     | C     |
| Name   | Age   | City  |
| Alice  | 28    | New York |
| Bob    | 35    | Los Angeles |
| Carol  | 42    | Chicago |

With the above Excel file and script, the output will be:

Cell data: New York


In this tutorial, you learned how to read a particular cell in an Excel file using Python programming and the openpyxl library. This skill is essential in data analysis and manipulation tasks. You can now easily extract specific cell data from Excel files for further processing and analysis.