S
S
StenMarsh13372020-07-15 18:22:41
Python
StenMarsh1337, 2020-07-15 18:22:41

How to extract text from excel?

Guys how to pull out the text from the excel "I enter - full name and pulls the entire line"
5f0f1f1d159b8306895680.png

from openpyxl import Workbook
from openpyxl import load_workbook
wb = load_workbook('test.xlsx')
ws1 = wb['Sheet1']
rows={}
dates = [int(x.value) for x in ws1.iter_rows(min_col=2,max_row=1).send(None)]
for row,name in enumerate([x.value for x in ws1.iter_cols(max_col=1,min_row=2).send(None)],2):
  rows[name]={}
  for col,date in enumerate(dates,2):
    rows[name][date] = ws1.cell(row,col).value
print(rows['Olena Kosr'][29])

print(list(rows['Olena Kosr'].values()))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-07-15
@dimonchik2013

name is clearly not in column 29

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question