Ask coding questions

← Back to all posts
how to use "openpyxl"
Mike0990 (0)

I aleady installed in my computer, but when I use by pycharm
it does'worked.I don't know why? and how to solve ?

code:

import openpyxl

wb = openpyxl.load_workbook("C:\excel_python\03\data\sample.xlsx")
for sheet in wb:
for row in sheet:
for cell in row:
print(cell.value)

message:

C:\Users\skk_f\PycharmProjects\untitled1\Scripts\python.exe C:/excel_python/03/python_prg/cell_scan.py
Traceback (most recent call last):
File "C:/excel_python/03/python_prg/cell_scan.py", line 1, in <module>
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'

Process finished with exit code 1

Comments
hotnewtop
SixBeeps (5221)

You're trying to reference the file at C:\excel_python\03\data\sample.xlsx, but that file doesn't exist on Repl.it's servers. Try uploading the Excel spreadsheet to your Repl and referencing that path.