Set a Default Column Width for CSV Files in Excel 2016
Question details
Set a consistent column width when opening large CSV files in Excel 2016.

- Product
- Microsoft Excel 2016
- Device & OS
- not provided
- Scenario
- The user repeatedly opens large CSV files and wants to avoid resizing narrow columns each time.
- Observed behavior
- CSV columns open narrow, and Excel does not offer a global default column-width setting specifically for CSV files.
Choose a column width to use, such as 20, and make sure macros are permitted by your organization's security settings. CSV files store data rather than Excel formatting, so column widths will not be retained when you save as CSV.
Open and Format CSV Files with a Reusable VBA Macro
Use this approach to apply the same width whenever you open a CSV through the macro.
Store the macro in the Personal Macro Workbook so it is available in future Excel sessions. The macro must be run to open each CSV; it does not change how files open when you double-click them.
In Excel, select View > Macros > Record Macro. Under Store macro in, choose Personal Macro Workbook, select OK, and then select View > Macros > Stop Recording.
Open the VBA editor from Developer > Visual Basic. In the Project window, select VBAProject (PERSONAL.XLSB), choose Insert > Module, and paste: Sub OpenCSVWithWidth() Dim filePath As Variant Dim csvBook As Workbook filePath = Application.GetOpenFilename("CSV Files (*.csv),*.csv") If VarType(filePath) = vbBoolean Then Exit Sub Set csvBook = Workbooks.Open(Filename:=CStr(filePath)) csvBook.Worksheets(1).Columns.ColumnWidth = 20 End Sub
In the VBA editor, replace 20 in the ColumnWidth line with the width you want. Close the editor and save changes to the Personal Macro Workbook when Excel prompts you.
Select View > Macros > View Macros, choose OpenCSVWithWidth, and select Run. Pick a CSV file in the file dialog; Excel opens it and applies the selected width.

Set the Default Width for the Current CSV Worksheet
Use this quick manual option when you only need to adjust the file currently open.
Work with CSV Files in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing spreadsheets. It supports common Excel formats for easier migration, although it does not change Excel's CSV defaults or make CSV files retain formatting.

Frequently Asked Questions
Why do my column widths disappear when I save a CSV?
CSV stores text data, not worksheet formatting. To retain column widths, choose File > Save As and save a copy as an Excel Workbook (*.xlsx).
Will an Excel template change the width of every CSV I open?
No. A custom template can set widths for new workbooks or worksheets, but opening a CSV directly does not automatically apply that template.
Where is the macro stored so I can use it again?
Store it in the Personal Macro Workbook, PERSONAL.XLSB. Create that workbook through View > Macros > Record Macro, and save its changes when Excel prompts you.
Can the macro format a CSV that is already open?
The provided macro opens a CSV selected in its file dialog. For an already open file, use Home > Format > Default Width or select columns and use Home > Format > Column Width.




