Data Import & Export

How to Prevent Excel from Truncating Milliseconds in CSV Dates

Kushani NimanthikaKushani Nimanthika Oct 28, 2026 869 views

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.

How to Keep Milliseconds in CSV Date and Time Formats in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Open a Blank Workbook

Launch Excel and create a completely blank workbook instead of opening the CSV file directly.

2
Start the Import Process

Navigate to the 'Data' tab on the ribbon and click on 'From Text/CSV'.

3
Locate Your CSV File

Browse your computer for the CSV file containing your millisecond data, select it, and click 'Import'.

4
Transform the Data

When the preview window appears, do not click Load immediately. Instead, click 'Transform Data' to open the Power Query Editor.

5
Format Column as Text

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'.

Use Power Query to Import CSV Data as Text
Preserved Formatting: Your dates will now display exactly as they appeared in the raw CSV, including the yyyy-MM-dd HH:mm:ss.fff formatting.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install and Launch: Follow the simple installation prompts, then open WPS Spreadsheets.
  3. 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.
Completely free and lightweight alternative to Microsoft Office.Fully compatible with Microsoft Excel formats including .xlsx, .xls, and .csv.Familiar user interface requires zero learning curve for Excel users.Smooth data import wizards to help you control text and date formatting.
microsoft office alternative - wps office

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.