title: Merge multiple excel files and keep formatting (Python)
body: <p>I've got simple code to merge excel files. But it keep losing the formatting. Are there any suggestions?</p>
  
  <p>Thanks for any reply!</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import openpyxl
  import os
  import glob
  
  all_names = []
  
  for x in os.listdir(r'C:\&lt;directory to excel files&gt;'):
      if x.endswith(".xlsx"):
          all_names.append(x[:-5])
          print(all_names)
  
  all_data = pd.DataFrame()
  for f in glob.glob("*.xlsx"):
      df = pd.read_excel(f)
      all_data = all_data.append(df,ignore_index=True)
  
  appended_df = pd.concat((all_data), keys=(all_names))
  appended_df.to_excel(r"C:\&lt;directory for merged file&gt;")
  </code></pre>