FileNotFoundError: [Errno 2] Нет такого файла или каталога: ошибка в xlrd - PullRequest
0 голосов
/ 10 июля 2019

Язык: Python-3.7.3 , xlrd : 1.2.0

Я получаю приведенную ниже ошибку при печати значения Excel, как показано ниже.

Код:

import xlrd


class ExcelOperations():

    def open_excel(self, filepath):
        return xlrd.open_workbook(filepath)

    def get_column_values(self, filepath):
        return self.open_excel(filepath).sheet_by_index(0).cell_value(1, 0)


run = ExcelOperations()
print(run.get_column_values(run.get_column_values(localfilepath)))

значение Excel

sheet1, A1(test),A2(test123)

Ошибка: -

FileNotFoundError: [Errno 2] No such file or directory: 'test123'

Код выглядит правильным и неуверенным, почему появляется эта ошибка. Кто-нибудь может мне помочь?

1 Ответ

1 голос
/ 10 июля 2019

заменить

print(run.get_column_values(run.get_column_values(localfilepath)))

на

print(run.get_column_values(localfilepath))
...