a = {'1': [1, 2, 3, 4], '2': [5, 6, 7, 8]}
a = pd.DataFrame(a)
writer = pd.ExcelWriter('test.xlsx', engine='xlsxwriter')
a.to_excel(writer, sheet_name='Sheet1')
writer.save()
How to dump a dictionary into an .xlsx file with proper column alignment?