Select to view content in your preferred language

Unable to post CSV to ArcGIS Online

640
5
Jump to solution
09-19-2024 08:04 AM
Labels (1)
ellipsol
Regular Contributor

I'm trying to post a CSV to ArcGIS Online from "Content", "New item" and it's giving me an error: "Error while analyzing file" like in the attached image. There are eight fields in this CSV and no repeat names nor any spaces nor characters other than underscore (_). There are 12 records in the CSV, nothing odd there standing out either. I've tried adding slightly modified tables as well but same generic error message. This issue started yesterday. I have been able to add CSVs previously.

Does anyone know what can be done?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
ellipsol
Regular Contributor

Eep I had forgotten about loading as a json, but you helped me remember. I converted the CSV to a gdb table, then to a feature class, then exported as a geojson and was able to load that! Good thinking! My Python script goes CSV ---> gdb table  ---> feature class ---> json. Then it deletes the rows and does edit_feature(adds = feature_service). All good!

View solution in original post

5 Replies
Ed_
by MVP Regular Contributor
MVP Regular Contributor

maybe try converting the CSV to a geodatabase table in Pro using the "Table to Geodatabase" tool and then publish that table to AGOL

Question | Analyze | Visualize
0 Kudos
ellipsol
Regular Contributor

Eep I had forgotten about loading as a json, but you helped me remember. I converted the CSV to a gdb table, then to a feature class, then exported as a geojson and was able to load that! Good thinking! My Python script goes CSV ---> gdb table  ---> feature class ---> json. Then it deletes the rows and does edit_feature(adds = feature_service). All good!

SteveWhitehead__GISP
Regular Contributor

I just found this as I have live google sheets coming into AGOL as csv feeds. Now they don't work after the update. Even trying to add them as a web file again as you say they don't work.

ellipsol
Regular Contributor

I'm not having success with loading CSV files, but if I convert the data to a geojson for the first load, it works. I put in 0,0 values for the x and y coords. That first load is manual. For subsequent updates, I load as just a json. I have a lot of non-spatial tables to update on AGOL. It seems involved, but it isn't much when it's scripted.

# create a JSON object from the local features
arcpy.conversion.FeaturesToJSON(
    in_features=output_feature_class,
    out_json_file=localJSON,
    format_json="FORMATTED",

)
# Read in json
fs = arcgis.features.FeatureSet.from_json(open(localJSON).read())

# Define your target feature layer
fl = arcgis.features.FeatureLayer(publishedWebLayer, mygis)
print("^" * 10)
# remove all features from the already published feature layer
# Make sure to delete by Object ID
fl.delete_features(where="ObjectId >= 0")
# Update info to match date field

update_dict = {'name':"",
               "description": "Specialized  " + str(max_date),
               'copyrightText':''
              }
fl.manager.update_definition(update_dict)
print("Name:", fl.properties.name)
print("Desc:", fl.properties.description)
# Add new data to AGOL
fl.edit_features(adds=fs)
print(arcpy.GetMessages(0))

 

SteveWhitehead__GISP
Regular Contributor

Thank you very much. I likely won't be doing this as it's already being converted from one unsupported file type to a supported file type. Another step  from google sheet to CSV to this...I just don't know.

0 Kudos