Convert CSV to Excel with Formatting
Turn a plain CSV into a professional Excel report. Learn how to auto-format as a Table, add filters, and adjust column widths automatically.
Convert CSV to Excel with Formatting
A CSV is ugly. It's just text. When you send a report to your boss or client, you don't want them to see a raw CSV. You want:
- Column headers in Bold.
- Filters enabled.
- Columns auto-sized to fit text.
- Alternating row colors (Zebra striping).
Here is how to turn a CSV into a polished Excel Table instantly.
The "Format as Table" Trick
- Open the CSV in Excel.
- Click anywhere inside your data.
- Press Ctrl+T (or Cmd+T on Mac).
- A dialog pops up: "Where is the data for your table?". Ensure "My table has headers" is checked.
- Click OK.
Boom.
- Your data is now an official Excel Table.
- Headers are blue and bold.
- Filters are added automatically.
- Row banding (colors) is applied.
- If you scroll down, headers stick to the top.
Auto-Fit Columns
Even with a table, some text might be cut off (###).
- Click the triangle at the top-left of the sheet (between A and 1) to select everything.
- Double-click the line between Column A and B headers.
- Excel will Auto-Fit every column width perfectly.
Saving as Excel
Crucial: You cannot save formatting in a CSV. If you hit Save now, Excel will warn you: "Some features may be lost." If you say Yes, all your pretty formatting is deleted.
You must:
- File > Save As.
- Change type to Excel Workbook (*.xlsx).
- Save.
Automating This (Python)
If you generate reports daily, don't do this manually. Use Python with xlsxwriter.
import pandas as pd
df = pd.read_csv('data.csv')
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('report.xlsx', engine='xlsxwriter')
# Convert the dataframe to an XlsxWriter Excel object.
df.to_excel(writer, sheet_name='Sheet1', index=False)
# Get the xlsxwriter workbook and worksheet objects.
workbook = writer.book
worksheet = writer.sheets['Sheet1']
# Add a header format.
header_format = workbook.add_format({
'bold': True,
'text_wrap': True,
'valign': 'top',
'fg_color': '#D7E4BC',
'border': 1})
# Write the column headers with the defined format.
for col_num, value in enumerate(df.columns.values):
worksheet.write(0, col_num, value, header_format)
writer.close()
Summary
- CSVs cannot hold formatting.
- Use Ctrl+T in Excel to instantly apply a professional Table style.
- Always Save As .xlsx to keep the look.
Need pretty reports? HappyCSV can help you clean your data before you style it in Excel.
Related Articles
Convert CSV to HTML Table
Convert CSV files to HTML table code for websites. Free online tool with proper escaping and semantic markup.
Convert CSV to Markdown Table
Convert CSV files to Markdown tables for GitHub README files, documentation, and blog posts. Free online tool.
Convert TSV to CSV (Tab-Separated to Comma-Separated)
Convert TSV files to standard CSV format. Free online converter for tab-delimited data. Works with Excel exports.
Need to handle CSV files?
HappyCSV is the free, secure way to merge, split, and clean your data — all in your browser.