Updating a csv file through a feature layer.

02-28-2024 10:12 AM
New Contributor II

Hello ! 

I am a bit new to python in Arcgis, and I would need help. 

I would like to update a csv automatically, based on a feature layer data. I am doing this currently by exporting the feature layer data manually, running a script that reads it, remove duplicates and writes a csv file in my folder and then I upload the file in Arcgis to update my arcgis online csv file. 

I would like this to be done in Arcgis Online automatically without having to run the treatment on my computer. I have the feeling the notebook functionality could help but I have no idea what would be an appropriate script. 

Can you help ? Thank you in advance 🙂

0 Kudos
3 Replies
Esri Contributor

This tutorial shows how to get a hosted feature service by searching for a name and by using it's ID value. It also shows writing a file to the notebook workspace storage.


This one shows using the Spatially Enabled Dataframe (a spatially extended version of a Pandas dataframe):


The pandas to CSV functions there, so you can use that syntax.


Once you have a CSV in the Notebook storage space, you can keep it there, or if you need to be able to access it, you can publish it/overwrite one in ArcGIS Online.


See also:





0 Kudos
New Contributor II

Thank you so much for your replay. I think I am almost there. I extracted data from survey123 in csv format. 


Now, i would like to directly write the item ct_data in Arcgis, without having to write it on my local computer first : is it possible ? 

0 Kudos
New Contributor II

An addition : I realized that running this script actually, generated the corresponding csv file on Arcgis Online. However, everytime I re-run this, it doesn't overwrite the csv file : it writes a new one. How can I make sure each time I run this script, the csv file is overwritten ? Also, is there a way I can write this csv file in a specific folder in Arcgis ? Thank you so much

0 Kudos