Skip to main content

What is a CSV file?

A CSV file is a plain-text file that stores table data in rows and columns, usually with commas separating the fields. You can open one in a spreadsheet application such as Microsoft Excel, import it into many database and analysis tools, or inspect it in a text editor; unlike the workbook formats covered in the spreadsheet formats guide, CSV does not preserve formatting, charts, multiple worksheets or most spreadsheet features. If a CSV opens incorrectly, the usual cause is a delimiter, encoding or automatic data-conversion problem rather than damage to the file.

RAW CSV TEXT id,zip 7,00501 8,02134 9,07030 Opened directly Imported as Text 501 2134 7030 ✕ zeros dropped 00501 02134 07030 ✓ zeros kept A CSV stores text — the spreadsheet guesses the type.
A CSV holds plain text. Opened directly, a spreadsheet guesses that ZIP codes are numbers and drops their leading zeros; importing the column as Text keeps them.

A CSV stores table values without the spreadsheet around them

Raw text (the file's real bytes)
sku,item,price
A1,Notebook,3.50
A2,"Pen, blue",1.20
A3,Stapler,8.00
Split on
Parsed as a grid

  • quoting "Pen, blue" stays one cell only because it is quoted — the comma inside is protected.
  • no types 3.50 is stored as text; nothing marks it as a number, a date or a formula.
  • no styling there is no bold, colour, or column width — a CSV holds values, not appearance.
A CSV is just text plus a separator: change the delimiter and the very same bytes parse into a different grid.

CSV stands for comma-separated values. The format represents a table as lines of text: each line normally becomes a row, and commas normally divide that row into fields or columns. The file usually has a .csv extension and the media type text/csv.

A simple contact list might look like this in a text editor:

Name,Department,Extension
Amina Shah,Finance,0142
Daniel Reed,Operations,0198
Mei Wong,Support,0107

A spreadsheet application interprets the commas as column boundaries and displays the same content as a grid:

Name Department Extension
Amina Shah Finance 0142
Daniel Reed Operations 0198
Mei Wong Support 0107

The grid is the application’s presentation of the data. The CSV file itself contains only the text, separators, quotation marks and line endings needed to describe the rows and fields.

Commas, quotation marks and line breaks define the table

CSV looks simple, but fields need special handling when their content includes a character that could otherwise change the table’s structure. A value containing a comma is normally enclosed in double quotation marks:

Product,Location,Price
Desk,"Portland, Oregon",249.00
Chair,"Austin, Texas",89.00

Without the quotation marks, Portland and Oregon could be interpreted as two separate fields. A field can also be quoted when it contains a line break. If a double quotation mark appears inside a quoted field, it is normally represented by two double quotation marks:

Product,Description
Notebook,"Includes a ""Project notes"" label"

The first line may contain column names, but a header row is optional. A well-formed file normally has the same number of fields in each record. If one row contains more or fewer separators than the others, the values after that point may appear under the wrong headings.

Although the name specifies commas, files described as CSV do not always use commas in practice. Some systems use semicolons because the comma is used as a decimal separator in the local number format. Other exports use tabs or another delimiter while retaining a .csv extension. The program opening the file must identify the actual delimiter or the entire row may appear in one column.

CSV preserves values, not workbook features

A CSV file is designed to exchange table data between systems, not to preserve the full state of a spreadsheet. When a workbook is saved as CSV, the active worksheet is flattened into text values. Features that depend on the workbook structure are not part of the CSV representation.

Feature CSV XLSX workbook
Cell values Yes Yes
Multiple worksheets No Yes
Fonts, colors and borders No Yes
Column widths and row heights No Yes
Charts and images No Yes
Formulas Usually exported as displayed values Yes
Comments and notes No Yes
PivotTables and workbook objects No Yes
Macros No No in .xlsx ; use .xlsm
Plain-text inspection Yes No

This is why a spreadsheet may look normal immediately after you save it as CSV but lose its appearance when you close and reopen it. The spreadsheet application still has the current workbook in memory, so it may continue displaying colors, formulas or adjusted column widths until the file is closed. When the CSV is opened again, the application can reconstruct only what the text file actually contains.

Check the delimiter, encoding and imported data types

A CSV may open without an error message and still display incorrect data. Before editing or saving it, check how the application has interpreted its separators, characters and values.

  • Look for everything in one column. This usually means the application did not recognize the file’s delimiter. The file may use semicolons, tabs or another character instead of commas.
  • Check whether columns shift partway down. One record may contain an unquoted comma, an unmatched quotation mark or an unexpected line break.
  • Inspect accented letters and symbols. Text such as José, München or currency symbols may appear as replacement characters when the application uses the wrong character encoding.
  • Compare long numbers with the original data. Spreadsheet software may convert an identifier to scientific notation or round digits when it treats the field as a number.
  • Check leading zeros. Postal codes, account references and product IDs such as 00142 may become 142 unless the column is imported as text.
  • Review dates. A value such as 03/04/2026 can mean March 4 or April 3, depending on the expected date convention.
  • Confirm decimal and thousands separators. 1,500 may be a number with a thousands separator, while 1,5 may be a decimal value in another locale. The delimiter and regional settings must be interpreted together.
  • Count the worksheets before exporting. Saving a workbook as CSV normally saves only the active sheet, not every tab in the workbook.

Opening a CSV directly is convenient when the data is simple and predictable. Importing it is safer when the file contains identifiers, dates, multilingual text or regional number formats. An import process usually lets you select the delimiter, character encoding and data type for each column before the values enter the spreadsheet.

A .csv extension does not prove that the content follows a particular convention. If the file opens as unreadable symbols rather than recognizable text, it may not be a CSV at all. Renaming an Excel workbook, PDF or another file to end in .csv changes only its name; it does not convert the underlying content.

Open, import or convert the CSV according to what you need next

The right way to handle a CSV depends on whether you only need to view its data, edit it as a table, preserve spreadsheet features or produce a document for sharing.

Open a straightforward CSV in a spreadsheet application

For a normal comma-delimited file with simple values, opening it directly is usually enough:

  1. Keep an untouched copy of the original CSV.
  2. Open Microsoft Excel or another spreadsheet application.
  3. Use the application’s Open command and select the CSV file.
  4. Confirm that the headings, rows and columns line up correctly.
  5. Check identifiers, dates and long numbers before making changes.
  6. If you need workbook features, save the opened data as a workbook such as .xlsx rather than overwriting the CSV.

Keep the original CSV when another system will need the same import format later. Your XLSX copy can be the editable working version, while the CSV remains the exchange copy.

Import a CSV when Excel guesses incorrectly

Use an import command instead of double-clicking the file when you need control over how its text becomes spreadsheet data. In current desktop versions of Excel, the relevant command is generally available from the Data tab through the text or CSV import option.

During import:

  1. Select the CSV without editing it first.
  2. Choose the character encoding that displays names and symbols correctly.
  3. Select the actual delimiter and check the preview.
  4. Mark identifiers, postal codes and similar fields as text if leading zeros must remain.
  5. Set date columns to the correct date order where the importer allows it.
  6. Review decimal and thousands separators for numeric columns.
  7. Load the data only after the preview shows the expected rows and columns.
  8. Save the resulting workbook as XLSX if you plan to format, calculate or add sheets.

If the preview places the complete record in one field, try a semicolon or tab delimiter. If columns split at commas that belong inside values, inspect whether those fields are correctly enclosed in double quotation marks. Repeated structural errors may need to be corrected in the system that created the export.

For data that must remain in CSV form, edit only the values and structure the receiving system expects. Avoid adding title rows, blank decorative lines or explanatory text unless the import specification permits them. Many systems expect the header to be the first row and every later row to contain the same set of fields.

If the destination is a fixed-layout document rather than another data system, convert or export the finished table only after checking its column widths, page size and page breaks. A PDF can preserve the visible layout for reading, sharing or printing, whereas CSV preserves editable records rather than page appearance.

Source: CSV record structure, headers, fields, quotation and escaping conventions from RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files, RFC Editor, and Excel CSV opening, import, delimiter, data-type, export and format-loss guidance from Import or export text (.txt or .csv) files, File formats that are supported in Excel, and Excel formatting and features that are not transferred to other file formats, Microsoft Support. Page last checked 2 October 2026.