Reputation: 391
I have tried to read an xlsx file which is stored in my system using jupyter notebook.I had run the jupyter notebook from the present directory where my file is present.But it is showing an error as "module not found error".
Upvotes: 4
Views: 74789
Reputation: 56
The below code should able to access /read your excel file
import pandas as pd
path = ('...\\filename.xlsx')
xl = pd.ExcelFile(path)
print(xl.sheet_names)
The above command shows the sheets in a xlsx file
df1 = xl.parse('Sheet1')
Above command parses the sheet required
Upvotes: 4
Reputation: 1
import pandas as pd
df = pd.read_excel('file_name.xlsx', 'Sheet1')
df
*you must import your .xlsx file into the Jupyter notebook file... *you may also import it into a Github repository and get the raw file then just copy and paste it into where it says 'file_name.xlsx'
[raw file URL example][1]
Upvotes: 0
Reputation: 21
Same outout, but this one worked for me.
import pandas as pd
df = pd.read_excel (r'C:\Users\(NAME)\Desktop\(FILENAME).xlsx')
print (df)
Upvotes: 2
Reputation: 55
import pandas as pd
wb = pd.ExcelFile('D:\\<Excel File Name>.xlsx')
ds = wb.parse('<Sheet Name>')
print(ds)
Upvotes: -1