<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automatically overwrite google sheets feature layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1121790#M6862</link>
    <description>&lt;P&gt;Maybe you could write the pandas df to a temp csv file on disk, then use the file path as the argument for FeatureLayerCollection.manager.overwrite() and delete the temp file.&amp;nbsp; Then it would mirror this example:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Could look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import tempfile
import os

g_csv = pd.read_csv(dwn_url)
with tempfile.TemporaryDirectory() as csvdir:
    local_csv = os.path.join(csvdir, 'pandas.csv')
    g_csv.to_csv(local_csv)
    layer_collection.manager.overwrite(local_csv)
    
    os.remove(local_csv)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See also:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/update-hosted-table-overwriting-it-with-local-csv/m-p/1078942#M6354" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/update-hosted-table-overwriting-it-with-local-csv/m-p/1078942#M6354&lt;/A&gt;&lt;/P&gt;&lt;P&gt;P.S. you may want to blur your photo if those are real phone numbers, don't want another Squid Game on our hands.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 18:59:06 GMT</pubDate>
    <dc:creator>ArcProOne</dc:creator>
    <dc:date>2021-12-01T18:59:06Z</dc:date>
    <item>
      <title>Automatically overwrite google sheets feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1120108#M6849</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; I have a google sheet with latitude/longitude columns that I added to ArcGIS Online via New Item &amp;gt; Google Drive &amp;gt; Google Sheets.&amp;nbsp; I would like to have this update automatically, but it seems the only way to update it (sync it with the Google Sheets source) is through ArcGIS Online, clicking Update Data &amp;gt; Overwrite Entire Layer.&amp;nbsp; How can I emulate that "Overwrite Entire Layer" functionality with python?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ArcProOne_1-1637787576429.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/28213iB6BCEFE37C29A0FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ArcProOne_1-1637787576429.png" alt="ArcProOne_1-1637787576429.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;I've looked through the API documentation and various forum posts, especially the top reply in &lt;A href="https://community.esri.com/t5/arcgis-online-questions/google-sheets-not-dynamic-in-agol/td-p/1049272" target="_blank" rel="noopener"&gt;this post&lt;/A&gt;&amp;nbsp;sounds very confident that there's a way to do it "quite easily!", but I can't seem to crack it.&amp;nbsp; I've tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;item = gis.content.get(item_id)
item.update(data=google_sheets_url)  # returns True, but does nothing&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where 'google_sheets_url' is the destination URL of the link on the AGOL item page:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ArcProOne_0-1637787374283.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/28212iCF36575A4708BA6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ArcProOne_0-1637787374283.png" alt="ArcProOne_0-1637787374283.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've also tried the FeatureLayerCollection.manager.overwrite() method, but I doubt that's the way to do it.&lt;/P&gt;&lt;P&gt;I can imagine an ugly workaround where I schedule a download of the google sheet as a csv, and do item.update() or flc.manager.overwrite() using the file on my disk, or schedule some kind of truncate+append.&amp;nbsp; But both of those involve a lot of seemingly unnecessary stuff in the background; it really seems there should be an easy way to sync with Google Sheets.&amp;nbsp; I appreciate any help in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 21:13:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1120108#M6849</guid>
      <dc:creator>ArcProOne</dc:creator>
      <dc:date>2021-11-24T21:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically overwrite google sheets feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1120550#M6854</link>
      <description>&lt;P&gt;I have tried reading csv using panda and am getting this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AbidHiraSaath_0-1638026567943.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/28337iE94032A23240B344/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AbidHiraSaath_0-1638026567943.png" alt="AbidHiraSaath_0-1638026567943.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I appreciate any help in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Nov 2021 15:23:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1120550#M6854</guid>
      <dc:creator>AbidHiraSaath</dc:creator>
      <dc:date>2021-11-27T15:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically overwrite google sheets feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1121790#M6862</link>
      <description>&lt;P&gt;Maybe you could write the pandas df to a temp csv file on disk, then use the file path as the argument for FeatureLayerCollection.manager.overwrite() and delete the temp file.&amp;nbsp; Then it would mirror this example:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Could look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import tempfile
import os

g_csv = pd.read_csv(dwn_url)
with tempfile.TemporaryDirectory() as csvdir:
    local_csv = os.path.join(csvdir, 'pandas.csv')
    g_csv.to_csv(local_csv)
    layer_collection.manager.overwrite(local_csv)
    
    os.remove(local_csv)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See also:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/update-hosted-table-overwriting-it-with-local-csv/m-p/1078942#M6354" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/update-hosted-table-overwriting-it-with-local-csv/m-p/1078942#M6354&lt;/A&gt;&lt;/P&gt;&lt;P&gt;P.S. you may want to blur your photo if those are real phone numbers, don't want another Squid Game on our hands.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 18:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/automatically-overwrite-google-sheets-feature/m-p/1121790#M6862</guid>
      <dc:creator>ArcProOne</dc:creator>
      <dc:date>2021-12-01T18:59:06Z</dc:date>
    </item>
  </channel>
</rss>

