How to import data in Python from excel?

Import data in Python from Excel.

pd.read_csv(‘file name.csv’)
pd.read_xlsx(‘file name.xlsx’)

You can easily import an Excel file into Python using Pandas. In order to accomplish this goal, you’ll need to use read_excel.

import pandas as pd

df = pd.read_excel (r’Path where the Excel file is stored\File name.xlsx’)
print (df)

And if you have a specific Excel sheet that you’d like to import, you may then apply:

import pandas as pd

df = pd.read_excel (r’Path where the Excel file is stored\File name.xlsx’, sheet_name=‘your Excel sheet name’)
print (df)