Reputation: 296
I am trying to access an Excel file in Python, but I'm getting the following error:
FileNotFoundError: [Errno 2] No such file or directory: 'input/sales-feb-2014.xlsx'
Could you please help me defining the path of the file?
Python Code:
from xlrd import open_workbook
sheet = open_workbook('input/sales-feb-2014.xlsx').sheet_by_index(0)
print (sheet.cell_value(3,0))
Upvotes: 1
Views: 1132
Reputation: 786
You either need to add the full path to open_workbook(your_full_path_comes_here)
or change the directory you are working in before.
You can use the os
module to before calling your variable.
import os
os.chdir(r'...your/path/input')
Upvotes: 2