Wenn ich dieses Script aufrufe
import openpyxl
import requests
from bs4 import BeautifulSoup
from urllib.parse import urlparse
excel_file_path = r"test.xlsx"
workbook = openpyxl.load_workbook(excel_file_path)
sheet = workbook.active
for row in sheet.iter_rows(min_row=2, min_col=3, max_col=3, values_only=True):
search_term = row[0]
search_url = "https://example.com/wiki/doku.php?id={search_term}"
response = requests.get(search_url)
soup = BeautifulSoup(response.text, "html.parser")
first_word = soup.get_text().split()[0]
sheet.cell(row=row[0].row, column=4).value = first_word
updated_excel_file_path = r"test_new.xlsx"
workbook.save(updated_excel_file_path)
bekomme ich diesen Fehler
Traceback (most recent call last):
File "C:\Users\tom\Desktop\test.py", line 20, in <module>
sheet.cell(row=row[0].row, column=4).value = first_word
AttributeError: 'str' object has no attribute 'row'
Wie kann ich das fixen?