MattCom
MattCom

Reputation: 259

openpyxl throwing error on load_workbook

My program is as simple as

import openpyxl

wb = openpyxl.load_workbook('C:\Users\filepath')

However when I run I receive a

'IndexError was unhandled by user code Message: list index out of range '

error. I can't seem to find any solutions to this online. My version of openpyxl is 2.4.8. If it helps I'm working on Visual Studio 2013.

Upvotes: 0

Views: 5328

Answers (1)

Tom
Tom

Reputation: 634

You need to specify the full path with extension. Like this

wb = openpyxl.load_workbook(filename='C:\Users\filepath\book.xlsx')

filename needs to be a path or a file-like object.

Upvotes: 1

Related Questions