-4

Suppose I have an excel sheet

Name Id Message
Alex 123 Hello
Mike 453 Hey There
Andy 865 How are you?
Ricky 987 Hi

I want to get an individual cell and use it as a variable in python First I want to get Alex, use it, then get Mike and so on

Can someone help me with this.

2
  • 1
    What are you using to read the excel sheet? Commented Jul 20, 2022 at 13:40
  • 1
    please show some research effort or code you have already written Commented Jul 20, 2022 at 13:42

1 Answer 1

0

You could use pandas for that.

import pathlib
import pandas

excel_file_path = pathlib.Path('my.xlsx')

df = pandas.read_excel(excel_file_path)

print(df.Name)  # something like ['Alex', 'Mike', 'Andy', 'Ricky']

This example assumes that there is only one sheet in the Excel file. The data starts at the first cell (A1) and the first row includes the column names.

Another package you could use is openpyxl.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.