PROBLEM

Publishing a CSV file as a hosted feature layer in ArcGIS Online returns error: Index was outside the bounds of the array

Last Published: April 25, 2020

Description

In some instances, after publishing a CSV file as a hosted feature layer in ArcGIS Online via My Content, the following error message displays in the Item Details page:

Error:
Index was outside the bounds of the array.

Cause

The error occurs when the final entry of the CSV is blank and there is no carriage return 'R' at the end, usually caused when the CSV ends with a comma. For example:

.../missionbaymarsh/marsh_closing_picture_thumbnail.jpg,
Note: This is a known issue in some versions of Excel on Mac OS, which does not include the carriage return when saving CSV files.

Solution or Workaround

Follow the steps below to resolve the issue:
Note: When using a Windows operating system, skip Steps 1 to 3 by opening and saving the CSV in Excel. The carriage return is added when saving the CSV in Excel for Windows.
  1. Open the CSV file in a text editor.
  2. Add 'R' after the final entry in the CSV file, and save the text file. For example:
.../missionbaymarsh/marsh_closing_picture_thumbnail.jpg,R
  1. Open the text file in Microsoft Excel, and save the file as CSV (with the .csv extension).
  2. Log in to ArcGIS Online, and go to My Content > Add Item > From my computer.
  3. In the Item from my computer dialog box, click Choose File, and select the CSV file to be published.
    • Ensure the Publish this file as a hosted layer check box is checked.
      Screenshot of a checked Publish this file as a hosted layer.
  4. Add tags for the hosted feature layer, and change the title if necessary.
  5. Click Add Item. The CSV file is successfully published without the error.

Article ID:000015597

Software:
  • ArcGIS Online

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic