AttributeError: module 'openpyxl' has no attribute 'load'
import openpyxl def parse_excel_file(file_path): workbook = openpyxl.load.workbook(file_path) worksheet = workbook.worksheet[0] for row in worksheet.iter_rows(): for cell in row: cell_value = cell.value print(cell_value, end='\t') print() workbook.close()
def main(): file_path = input("Enter the path to the Excel file") parse_excel_file(file_path) if name == 'main': main()
Above is the script I am running. I am getting the error (below) upon entering the file location.
parse_excel_file('/Users/jameshanway/Desktop/SNHU/Elective Options for MS.IT(1).xlsx') Traceback (most recent call last): File "<pyshell#22>", line 1, in parse_excel_file('/Users/jameshanway/Desktop/SNHU/Elective Options for MS.IT(1).xlsx') File "<pyshell#10>", line 2, in parse_excel_file workbook = openpyxl.load.workbook(file_path) AttributeError: module 'openpyxl' has no attribute 'load'