#■■■ EXCELのシートにあるコメントを得る
from openpyxl import load_workbook, Workbook
from openpyxl.comments import Comment
dir_excel_target = "C:/Users/shienkikou11/Desktop/"
name_excel_target = "testfile_comment.xlsx"
path__excel_target = dir_excel_target + name_excel_target
wb = load_workbook(path__excel_target)
ws = wb.active
row_count = ws.max_row
print(f'ターゲットとなるシートの行数は{row_count}です。')
for row in ws.iter_rows(min_row=1):
for cell in row:
if cell.comment is None:
continue
row_count = row_count + 1
com_cell = cell.comment.text
auther_com = cell.comment.author
cord_com = cell.coordinate
print(com_cell,auther_com,cord_com)
print("end")
wb.close()