/
rnekrasov
/
Python
Обзор
Документация
Войти
/
rnekrasov
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
read_excel_file.py
26 строк
628 B
slowy07
refactor: clean code
30 янв 2022, 04:33
30 янв 2022, 04:33
f0af0c4
Код
Авторство
О чём код?
# extract number of rows using Python import xlrd # Give the location of the file loc = "sample.xlsx" wb = xlrd.open_workbook(loc) sheet = wb.sheet_by_index(0) sheet.cell_value(0, 0) # Extracting number of rows print(sheet.nrows) # extract number of columns in Python print(sheet.ncols) # extracting all columns name in Python for i in range(sheet.ncols): print(sheet.cell_value(0, i)) # extracting first column sheet = wb.sheet_by_index(0) for i in range(sheet.nrows): print(sheet.cell_value(i, 0)) # extract a particular row value sheet = wb.sheet_by_index(0) print(sheet.row_values(1))