How search data in excel with openpyxl

0 votes

CODE

import openpyxl
wb = openpyxl.open('the path to the file')

wb.active = 1
ws = wb.active

for row in ws.iter_rows('B4:F4'):
for cell in row:
if cell.value == "Maria":
print(ws.cell(row=cell.row, column=2).value)

Mistake: for row in range(min_row, max_row + 1):

TypeError: 'str' object cannot be interpreted as an integer

Excel table

I need to search "Pavel" and print it in the console

Where is the mistake?

Oct 1, 2022 in Others by Kithuzzz
• 38,010 points
5,575 views

1 answer to this question.

0 votes

The method iter_rows in the library has changed, refer to this answer:

How we can use iter_rows() in Python openpyxl package?

answered Oct 2, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
0 answers

Data Driven Framework -- how to read and write in excel sheet using Selenium WebDriver with java

I'm using this code to read something, ...READ MORE

Oct 31, 2022 in Others by Kithuzzz
• 38,010 points
467 views
0 votes
1 answer
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,420 points
818 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Converting all tabs of excel sheet to PDF

Using VBA, try it like this, for ...READ MORE

answered Sep 26, 2022 in Others by narikkadan
• 63,420 points
1,289 views
0 votes
1 answer

How to insert info into online excel spreadsheet with python selenium

I recently discovered one of my options, ...READ MORE

answered Oct 24, 2022 in Others by narikkadan
• 63,420 points
895 views
0 votes
1 answer

Python Excel Writer (xlswriter) Insert Image from URL

Use this: url = "..../picture.jpg" data = urllib.request.urlopen(url).read() file = ...READ MORE

answered Nov 17, 2022 in Others by narikkadan
• 63,420 points
1,424 views
0 votes
1 answer

How to export data with functions to another workbook in excel

The issue appears to be that once ...READ MORE

answered Oct 30, 2022 in Others by narikkadan
• 63,420 points
300 views
0 votes
1 answer

How can I count the rows with data in an Excel sheet?

With formulas, what you can do is: in ...READ MORE

answered Dec 27, 2022 in Others by narikkadan
• 63,420 points
344 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP