How to Prevent Excel from Truncating Milliseconds in CSV Dates
Question details
The user wants to prevent Excel from automatically changing the default date and time format and truncating milliseconds when a CSV file is opened directly.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Opening a CSV file containing precise date and time values (e.g., yyyy-MM-dd HH:mm:ss.fff) by double-clicking the file.
- Observed behavior
- Excel automatically recognizes the date and time values but applies a shortened default format, effectively hiding or stripping the millisecond data.
Open your original CSV file using a plain text editor like Notepad to confirm that the millisecond data is actually present in the raw file before attempting to import it.
Use Power Query to Import CSV Data as Text
Instead of double-clicking the CSV file, use Excel's Power Query (an ETL process) to import the data and explicitly set the date column as text to prevent auto-formatting.
Since Excel does not have a setting to change the default double-click import behavior, the most reliable method is to use the Data import tools. This stops Excel from applying its hard-coded date formats.
Launch Excel and create a completely blank workbook instead of opening the CSV file directly.
Navigate to the 'Data' tab on the ribbon and click on 'From Text/CSV'.
Browse your computer for the CSV file containing your millisecond data, select it, and click 'Import'.
When the preview window appears, do not click Load immediately. Instead, click 'Transform Data' to open the Power Query Editor.
Select the column containing your dates and times. Change its Data Type from 'Date/Time' to 'Text', choose 'Replace current' if prompted, and then click 'Close & Load'.

Add a Leading Apostrophe to the Raw Data
Modify the raw CSV data using a script or application to prefix date and time values with an apostrophe, forcing Excel to read them as plain text.
Handle Complex Datasets and CSV Imports Seamlessly with WPS Office
Microsoft Excel's hard-coded data formatting can be restrictive when you need precise control over your CSV files. WPS Office offers a free, lightweight, and highly compatible alternative, providing powerful spreadsheet tools that handle your raw data efficiently while giving you a familiar interface.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install and Launch: Follow the simple installation prompts, then open WPS Spreadsheets.
- 3. Open Your Files Seamlessly: Drag and drop your CSV or Excel files directly into the application to continue working exactly where you left off.

Frequently Asked Questions
Why does Excel remove the milliseconds from my CSV dates?
When you open a CSV file directly by double-clicking, Excel applies its default 'General' format. This hard-coded behavior automatically parses recognized date and time strings and formats them according to your system's default regional settings, which typically do not include milliseconds.
Can I change the default Excel behavior for opening CSV files?
No, Excel does not provide a built-in setting or template configuration to change the default import behavior when double-clicking a CSV file. You must use workarounds like the Power Query import process or format the source data as text.
How can I calculate time differences if I import the dates as text?
If you import the dates as text to preserve the milliseconds, you can use Excel formulas like VALUE(), TIMEVALUE(), or text extraction functions (like LEFT and RIGHT) in an adjacent column to convert the text back into calculable numbers when you need to perform math.




