#author:tja
import openpyxl
from openpyxl.utils import get_column_letter
from docx import Document

workbook = openpyxl.load_workbook('E:/app collection/CodeBlocks/cpp items/VScode/scripts_others/test.xlsx')
sheet = workbook.active

max_col = sheet.max_column
max_row = sheet.max_row

doc = Document()

sheet = workbook['Sheet1']

for col in range(2, max_col + 1):
    col_name = get_column_letter(col)
    name_receiver = sheet[f'{col_name}1'].value
    print(name_receiver)
    doc.add_paragraph(name_receiver)

    for row in range(2, max_row + 1):
        name_speaker = sheet[f'A{row}'].value
        cell_value = sheet[f'{col_name}{row}'].value
        if cell_value == "(空)":
            continue
        print(f'{name_speaker}: {cell_value}')
        doc.add_paragraph(f'{name_speaker}: {cell_value}')

doc.save('output.docx')