How-To

Invalid number / invalid field count in SFMC data extension import

"Invalid number / invalid field count" means a row in your CSV has a different number of columns than the import expects, or a value that doesn't fit a Number field. Check stray commas, blank rows, delimiter and mapping first, then data types, then file encoding.

Sohail HussainSohail Hussain9 min read

Short answer

  • The import failed validation because a row has a different number of columns than the mapping expects, or a value in a Number field is not a valid number.
  • Open the CSV in a plain-text editor, look for unquoted commas, blank or comma-only lines and text in numeric columns, fix them, save as UTF-8 and import again.
  • If the file is large, split it in halves and import each into a scratch data extension to find the bad row.

Your Salesforce Marketing Cloud (SFMC) data extension import stops with this message:

invalid number / invalid field count

The file looked fine in Excel, and you cannot see which row is wrong. This page is a way to find that row quickly. I can't see your file, so treat the causes below as a ranked list, not a diagnosis. SFMC's wording and validation behavior can change, so confirm details against Salesforce's own documentation if something here differs. People on Salesforce's community forums report this error most often on files exported from spreadsheets or CRMs.

Why it happens

The message bundles two separate checks, and a file can fail either one.

  • Invalid field count. The importer splits each line by the delimiter and compares the number of fields with the columns in your import mapping. A line with 11 fields against a 10-column mapping is rejected.
  • Invalid number. A value headed for a Number or Decimal field cannot be parsed as a number. Letters, currency symbols, thousands separators, a stray space or a placeholder like N/A all count.

Both are file validation failures. They are not delivery errors, and your sending reputation is not involved.

The two often appear together. One unquoted comma shifts every later value one column to the right, so text lands in a numeric field on the same row.

CauseTypical symptomFix
Unquoted comma in a valueBoth errors on the same rowQuote the field or re-export with quoting on
Blank or comma-only linesField count error near the end of the fileDelete the empty lines
Text or symbols in a Number columnInvalid numberClean the column or change the field to Text
Mapping or delimiter mismatchError on every rowFix delimiter, header setting and column order
Encoding, BOM, line breaks in cellsError on the first row or on odd rowsSave as UTF-8, quote multi-line cells

Step-by-step fixes

Open the file as plain text first

Excel hides most of what causes this. It reformats numbers, drops leading zeros and shows a row with trailing commas as if it were fine. Open the CSV in a text editor (Notepad++, VS Code, or TextEdit in plain-text mode) and read the raw lines.

  1. Confirm the header row has the same number of fields as the data rows.
  2. Look for lines that end in extra commas, which happens when cells are cleared in Excel instead of columns being deleted.
  3. Look for completely empty lines, especially at the end of the file.
  4. Look for values containing commas that are not wrapped in double quotes.

Fix unquoted commas inside a value

This is the most common cause of a field-count mismatch. A company name like Acme, Inc. or an address like 12 Main St, Suite 4 adds a column to that row unless it is quoted.

Correct:

Email,Company,Employees
jane@example.com,"Acme, Inc.",120

Incorrect:

Email,Company,Employees
jane@example.com,Acme, Inc.,120

The second data row has four fields against a three-column header, and Inc. lands in the Employees column, which also triggers the invalid number error. To find these rows, compare each line's field count with the header's; a spreadsheet formula or a short script that prints the column count per row does it quickly. The durable fix is to re-export from the source system with quoting enabled.

Do not save over your only copy

Keep the original export untouched and edit a copy. A search-and-replace in a text editor can change thousands of rows at once, and you will want the original to compare against.

Remove blank rows and trailing delimiters

A blank line has zero or one empty field depending on the parser, and neither matches your column count. These usually sit at the bottom of the file after someone deleted data but left the rows.

  1. Scroll to the end of the file and delete empty lines.
  2. Search for lines containing only commas, such as ,,,,. Excel exports these for cleared rows.
  3. Save and import again.

Clean non-numeric values in Number columns

Once the field count is right, check the Number columns. All of these fail:

  • $1,250.00 (currency symbol and thousands separator)
  • 1 250 or 1.250,50 (locale-specific formatting)
  • N/A, null, - or TBD
  • 12 with a trailing space
  • Scientific notation from Excel, such as 1.23E+11, on long IDs

Fix them in this order:

  1. Clean the column at the source so it holds plain digits, a period as the decimal separator and no grouping characters.
  2. If the value is an identifier (phone number, ZIP code, account ID, anything with leading zeros), change the data extension field to Text. Numbers lose leading zeros and long IDs get mangled.
  3. Leave truly missing values empty instead of typing placeholder text. Whether an empty value is accepted depends on whether the field is nullable and has a default, so check the field's properties in the data extension.

Match the mapping to the file

If the data extension has 10 fields and your file has 12 columns, SFMC can complain about the count even when the file is clean. A file with columns in a different order can also push text into a Number field.

  1. Open the import definition, or the import step under the Data Extensions area, and view the column mapping.
  2. Confirm the delimiter setting matches the file. A semicolon-separated file read as comma-separated gives one giant field per row.
  3. Check whether the file has a header row and that the import is set to expect one. If the header is read as data, its text values fail in Number columns.
  4. Map by column name where the option exists, or reorder the file's columns to match.

Check encoding and invisible characters

Save the file as UTF-8. Files saved as UTF-16 or a legacy code page can produce stray characters that break parsing. A byte order mark (BOM) at the start of a UTF-8 file can attach to the first header name so the first column fails to match; choose "UTF-8 without BOM" where your editor offers it.

Other invisible culprits are non-breaking spaces copied from web pages and line breaks inside a cell, such as a multi-line address. A line break inside an unquoted value splits one record into two lines, each with the wrong field count. Quote the field or strip the line break.

Split large files to find the bad row

If the file is big and you can't spot the problem, bisect it.

  1. Split the CSV into halves, keeping the header in each.
  2. Import each half into a scratch data extension with the same structure.
  3. The half that fails holds the problem; split that one again.

A few rounds narrows 100,000 rows to a handful. Smaller files are also easier to retry. Salesforce publishes file-size guidance for imports; check its current help page for the number rather than relying on a forum post.

Test in a scratch data extension first

Before importing into a data extension that feeds automations or sends, create a copy with the same fields and import there.

Check the import action

Choose between overwrite and add-and-update deliberately. An import that overwrites the wrong target is a worse problem than a validation error.

When the scratch import is clean, run the real one.

Checklist before you try again

  • The header has the same number of fields as every data row.
  • Values containing commas are wrapped in double quotes.
  • No empty lines and no comma-only lines remain.
  • Number columns contain only digits, an optional minus sign and a period.
  • Identifiers and anything with leading zeros are Text fields.
  • The delimiter and header-row settings match the file.
  • The file is saved as UTF-8, ideally without a BOM.

If nothing works

If the file passes every check above and still fails, open a case with Salesforce Support. Include:

  • The exact error text and the time of the attempt.
  • The data extension's name and its field list with data types and lengths.
  • The import definition or a screenshot of the mapping.
  • A small anonymized sample (5 to 10 rows) that reproduces the error.
  • Whether the same file ever imported before, and what changed.

A short message you can adapt:

Subject: Data extension import fails with "invalid number / invalid field count"

Hi Salesforce Support,

Import into data extension "{data-extension-name}" fails with:
invalid number / invalid field count

Time of attempt: {date, time, timezone}
Import type: {manual import / import activity in Automation Studio}
Field list with types and lengths: attached
Mapping screenshot: attached
Sample file (8 anonymized rows) that reproduces the error: attached

Already tried: viewed the raw CSV in a text editor, quoted values with commas,
removed blank rows, confirmed UTF-8 and the delimiter, imported halves into a
scratch data extension.
This file {has / has not} imported successfully before. Change since then: {change}.

Please tell us which row or field fails validation.

Common questions

Why does the file open fine in Excel but fail to import?

Excel tolerates things the importer does not: trailing commas, blank rows, numbers displayed with currency formatting and scientific notation on long IDs. Check the raw text, not the spreadsheet view.

Can I just make every field Text to avoid the invalid number error?

For identifiers, yes, and it is the right choice. For fields you plan to sort, filter or calculate on, keep a numeric type and clean the data instead.

Does this error affect my sender reputation?

No. It is a file validation failure on import and nothing has been sent.

Why do I see both errors for one row?

Usually one unquoted comma. It adds a field to the row and pushes text into a numeric column at the same time. Fix the quoting and both messages typically disappear.

technicalsalesforce-marketingerror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

How-To

ActiveCampaign n8n error 301 on create contact: causes and fixes

A 301 from the ActiveCampaign node means the request went to a URL that redirects, so start with the API URL in your n8n credential. Copy it from Settings, then Developer, and check the scheme and path. Zapier 403 and cURL error 28 behind Cloudflare have different causes, covered below.

Sohail Hussain|9 min read
How-To

"Stage not on allowlist": Apollo to HubSpot sync fix

The error "Stage not on allowlist" means the contact's Apollo stage is not on the list of stages permitted to push to HubSpot. Open the HubSpot integration in Apollo, go to the Sync tab, and add that stage under "Stages for push contacts". Lifecycle stage mapping is a separate setting.

Sohail Hussain|7 min read
How-To

Salesmate "Authorization with Gmail failed": Gmail IMAP fix

Salesmate shows "Authorization with Gmail failed" when it can't read your Gmail account over IMAP. In Gmail settings, enable IMAP, choose "Do not limit the number of messages in an IMAP folder", and show All Mail in IMAP. Then reconnect the account in Salesmate. Other causes are covered below.

Sohail Hussain|8 min read
How-To

AWeber export "Stop Status" and "Stop Time" columns explained

In an AWeber subscriber export, a non-empty Stop Time and a non-zero Stop Status most likely mean the person has stopped receiving your mail, usually because they unsubscribed. AWeber doesn't explain the columns in the file, so verify against a few known unsubscribes, then import those rows as blocked, not subscribed.

Sohail Hussain|7 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free