Reading from a Spreadsheet

Shows how to read a cell in .xls or .xlsx spreadsheet.


*Edit line 4 in the script to correctly reflect the directory location of a spreadsheet with numerical values in its cells.


from openpyxl import load_workbook
 
# open a workbook, replace with your own path
wb = load_workbook(filename = 'C:\\Users\\<username>\\Downloads\\Book1.xlsx')
 
# get access to the sheet
Sheet1 = wb['Sheet1']
 
# get the value in cell C3
print Sheet1['C3'].value


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.