xlsx under heading
-
I'm trying to get a subtitle in the table, trying to get some sort of result.
df = pd.DataFrame({ 'name': ['Manchester City', 'Real Madrid', 'Liverpool','FC Bayern München', 'FC Barcelona', 'Juventus'], 'activity_type': ['English Premier League (1)', 'Spain Primera Division (1)','English Premier League (1)', 'German 1. Bundesliga (1)','Spain Primera Division (1)', 'Italian Serie A (1)'], 'full_name_licensee': [176000000, 188500000, 90000000,100000000, 180500000, 105000000]}) df.to_excel("test.xlsx",index=False)
That's how I managed to make headlines for every column, how I can make the headline that starts with.
1А
and ends.1J
-
It's easier to record DataFrame in Excel using Pandas Pandas, and then "doing" using all "paint"
openpyxl
:from openpyxl import load_workbook from openpyxl.styles import Alignment
df.to_excel("tmp.xlsx", index=False)
wb = load_workbook("tmp.xlsx")
ws = wb.activews.insert_rows(0)
ws["A1"] = "LICENSE"
ws.merge_cells(start_row=1, start_column=1, end_row=1, end_column=10)
ws['A1'].alignment = Alignment(horizontal='center')wb.save("result.xlsx")
wb.close()