K
K
Konstantin Malyarov2018-06-19 15:37:46
Python
Konstantin Malyarov, 2018-06-19 15:37:46

How to get cell value 'A1', 'A2'?

There is an xlrd library that has a function that returns the name of the cell:
print (xlrd.cellname(row, col))
Is there a function in this library:
print (xlrd.get_value('A1'))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
Xander017, 2018-06-19
@Xander017

Apparently, just like this

import xlrd 
book = xlrd.open_workbook("***.xlsx")
sheet = book.sheet_by_index(0)
print(sheet.cell_value(rowx=0, colx=0))

where are the column number and row number. But if you use openpyxlrowx=0, colx=0
from openpyxl import load_workbook
wb = load_workbook(filename = '***.xlsx')
sheet_ranges = wb['Лист1']
print(sheet_ranges['A1'].value)

It will all work out ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question