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?
Solved! Go to Solution.
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!
maybe try converting the CSV to a geodatabase table in Pro using the "Table to Geodatabase" tool and then publish that table to AGOL
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!
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.
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))
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.