English
Continue in the app
Be The First To Get Support Updates
Want to know about the latest technical content and software updates?

Problem: Generic errors from uploading and published CSV files as hosted feature layers

Description

In some instances, generic errors occur when CSV files are uploaded or published as hosted feature layers in ArcGIS Online or Portal for ArcGIS.

When opening the item details page of the CSV file as a hosted feature layer, this error is returned.

Error:
There was an error.

When adding the layer to Map Viewer, this error is returned.

Error:
Can't add layer to map.

Other error  instances that can occur include: being unable to apply date, time or numeric field configuration in a web app or date filters or time sliders.

Cause

The field type does not match with the data in the CSV file, causing errors or limitations on field-type based functionalities.

Unlike file geodatabases or shapefiles with defined field types for each attribute field that are used to create the web layer, CSV files do not contain field types to store geographic data formats. Instead, the first few rows of data in a CSV file are evaluated to determine which field type is assigned to the CSV file when they are uploaded to create the hosted feature layer.

This could result in the assigned field type not matching with the data if there are inconsistent values. For example, string (text) data cannot go into an integer field.

Some ways that could cause a mismatch between the assigned field with the data.

  • Field names are empty.
Image of a CSV file in Excel showing empty columns for field names.
  • Field names are duplicated.
Image of a CSV file in Excel showing duplicated headings for field names.
  • Field names have special characters, reserved words, or commas.
  • There are merged cells in the CSV file.
  • A date or integer field have string values.
Image of a CSV file in Excel showing string values in integer fields (those aligned to the left).
  • Data is using mixed date formats, such as '25/1/2000' and '1/25/2000' which are invalid for Date fields that prevents date-based functionality.
Image of a CSV file in Excel showing date values using different date formats.
  • Data contains non-English characters, for example, characters specific to the French, Russian, Greek, Japanese, or Arabic alphabets and encoded in ASCII. If an ASCII-encoded file is imported containing non-English characters, it may display attribute values using unexpected characters.
  • Location fields have inconsistent spatial reference.
  • Integer fields are used for decimal values.
Image of a CSV file in Excel showing whole and decimalized values in integer fields.

Solution or Workaround

Before uploading the CSV file, ensure that the file is prepared for the following:

  • Each field name is populated.
  • Each field name is not duplicated.
  • Each field name replaces any characters with an underscore ('_') and no commas.
  • Unmerge cells in Excel.
  • Check for string values for for fields intended for dates or numeric (float, integer, double). A cell not aligned to the right would suggest that it is a string value.
  • Use a consistent date format, either as ddmmyy or mmddyy. 
  • Save the CSV file as UTF-8 or Unicode in Windows. Open the file in a text editor such as Notepad, click File > Save As, and choose UTF-8 or Unicode from the Encoding drop-down menu shown at the bottom of the Save As dialog box.
  • Location fields should be in a consistent and known spatial reference. Refer to ArcMap: The properties of a spatial reference for more information.
  • Use integer fields are for whole numeric values, for example, '1' or '764'. Or reassign the field type to float or double for decimal values in the CSV, for example, '1.1' or '764.2'. Refer to How To: Change the data type of an existing field for more information.

Related Information

Last Published: 1/20/2021

Article ID: 000024821

Software: Portal for ArcGIS 10.8.1, 10.8, 10.7.1, 10.7, 10.6.1, 10.6