Output Format

Input Data

Converted Output

Understanding Delimiters

A delimiter is a character that separates values in a data file. Different systems and applications use different delimiters, and converting between them is essential for data import/export workflows.

Common Delimiter Types

FormatDelimiterExtensionUse Case
Excel ColumnNewline (\n).txtExcel paste, one value per row
CSVComma (,).csvMost common, universal support
TSVTab (\t).tsv, .txtExcel, database imports
PipePipe (|).txtSystems that allow commas in data
SemicolonSemicolon (;).csvEuropean Excel (uses comma as decimal)

When to Use Each Format

Excel Column Format (Newline)

Best for:

  • Pasting directly into Excel (one value per cell vertically)
  • Creating dropdown lists in Excel data validation
  • Importing into database tables (one row per value)
  • Reading line-by-line in scripts
AAPL
MSFT
GOOGL

Comma-Separated (CSV)

Best for:

  • Universal data exchange
  • Importing to most applications
  • Email lists, contact lists
  • Web form submissions
AAPL, MSFT, GOOGL

Tab-Delimited (TSV)

Best for:

  • Excel data with commas in values
  • Database bulk imports (PostgreSQL COPY)
  • Clipboard operations between applications
  • Log file parsing
AAPL    MSFT    GOOGL

Pipe-Delimited

Best for:

  • Data containing commas and tabs
  • Legacy database systems
  • Unix/Linux data processing
  • ETL pipelines
AAPL | MSFT | GOOGL

Semicolon-Separated

Best for:

  • European Excel (comma is decimal separator)
  • Localized applications
  • Regional data standards
AAPL; MSFT; GOOGL

Excel Integration

Importing to Excel

Method 1: Text to Columns

  1. Paste your delimited data into Excel
  2. Select the cell(s)
  3. Data tab → Text to Columns
  4. Choose "Delimited"
  5. Select your delimiter (Comma, Tab, Other)
  6. Finish

Method 2: Import Data

  1. Data tab → Get Data → From Text/CSV
  2. Select your file
  3. Excel auto-detects delimiter
  4. Click Load

Exporting from Excel

Save As Formats:

  • CSV (Comma delimited): .csv file
  • CSV (Macintosh): Mac line endings
  • CSV (MS-DOS): Windows line endings
  • Text (Tab delimited): .txt file
  • Unicode Text: UTF-16 tab-delimited

Database Import Examples

PostgreSQL COPY

-- Tab-delimited import
COPY tickers FROM '/path/to/file.tsv' 
  DELIMITER E'\t' 
  CSV HEADER;

-- Pipe-delimited import
COPY tickers FROM '/path/to/file.txt'
  DELIMITER '|'
  CSV HEADER;

MySQL LOAD DATA

-- CSV import
LOAD DATA INFILE '/path/to/file.csv'
INTO TABLE tickers
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;

SQL Server BULK INSERT

-- Tab-delimited import
BULK INSERT tickers
FROM 'C:\data\file.tsv'
WITH (
  FIELDTERMINATOR = '\t',
  ROWTERMINATOR = '\n',
  FIRSTROW = 2
);

Programming Examples

Python

import csv

# Read CSV
with open('tickers.csv') as f:
    reader = csv.reader(f)
    tickers = [row[0] for row in reader]

# Write pipe-delimited
with open('tickers.txt', 'w') as f:
    f.write('|'.join(tickers))

# Using pandas
import pandas as pd
df = pd.read_csv('tickers.csv')
df.to_csv('output.tsv', sep='\t', index=False)

JavaScript

// Convert CSV to array
const csv = "AAPL,MSFT,GOOGL";
const array = csv.split(',').map(s => s.trim());

// Convert array to pipe-delimited
const piped = array.join(' | ');

// Convert to newline-separated
const column = array.join('\n');

Excel VBA

Sub ConvertDelimiter()
    Dim cell As Range
    Dim arr() As String
    
    ' Split comma-separated value
    arr = Split(ActiveCell.Value, ",")
    
    ' Output as column
    For i = LBound(arr) To UBound(arr)
        ActiveCell.Offset(i, 0).Value = Trim(arr(i))
    Next i
End Sub

Common Issues & Solutions

Issue #1: Commas Within Data

When your data contains commas:

❌ CSV: "Apple, Inc.", MSFT, GOOGL  (breaks on first comma)
✓ TSV: "Apple, Inc."    MSFT    GOOGL  (preserves commas)
✓ Pipe: "Apple, Inc." | MSFT | GOOGL  (preserves commas)

Issue #2: Excel Auto-Formatting

Excel may interpret tickers as dates or numbers:

  • Prefix with apostrophe: 'AAPL
  • Format cells as Text before pasting
  • Use Power Query to import as text

Issue #3: Line Ending Differences

  • Windows: \r\n (CRLF)
  • Unix/Mac: \n (LF)
  • Old Mac: \r (CR)

Most modern applications handle all three automatically.

Best Practices

Choose the Right Delimiter

  1. Know what characters might appear in your data
  2. Match the format to your destination system
  3. Document the delimiter used in file names (e.g., data_pipe.txt)

Handle Special Characters

  • Quote fields containing delimiters
  • Escape quotes within quoted fields ("")
  • Consider using a rare delimiter (e.g., pipe) if data is complex

Test Imports

Always test with a small sample before importing large datasets:

  1. Export 5-10 rows
  2. Test import to destination
  3. Verify data integrity
  4. Then import full dataset

Quick Reference

TaskBest Format
Excel paste (vertical)Column (newline)
Email listComma-separated
Database importTab or pipe
Data with commasTab or pipe
European regionSemicolon
Log file outputTab or pipe
API parameter listComma-separated