<?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: Downloading AGOL feature as Excel file and shapefile with Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035142#M5690</link>
    <description>&lt;P&gt;ah ok, possibly this might help if it's exported as a hosted feature layer&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/download-item-data/td-p/872105" target="_blank"&gt;Download Item Data - Esri Community&lt;/A&gt;&amp;nbsp;but unfortunately I can't test anything, and I'm straying away from my experience. Perhaps:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features.manage_data import extract_data

shapefile = extract_data([getTheExportedItems])
shapefile.download('C:\\outFolder')&lt;/LI-CODE&gt;&lt;P&gt;good luck!&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 20:58:39 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-03-10T20:58:39Z</dc:date>
    <item>
      <title>Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035078#M5685</link>
      <description>&lt;P&gt;I am trying to download an existing AGOL feature layer to a local server as both an excel file and shapefile using python.&amp;nbsp; The file is downloading however the shape file is only downloading the .shp file and non of the other files (cpg, dbf, prj, shx) and both the .shp and .xlsx files are producing an unregistered error message in ArcMap.&amp;nbsp; When I manually download the feature layer as a shapefile in AGOL it gives me a shapefile zipfile with all files that loads into ArcMap without error.&amp;nbsp; How can I replicate this with python?&amp;nbsp; I am new to AGOL and python 3.&amp;nbsp; Here is my code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcgis&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;arcpy &lt;SPAN&gt;import &lt;/SPAN&gt;env&lt;BR /&gt;arcpy.env.overwriteOutput = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;arcgis.gis &lt;SPAN&gt;import &lt;/SPAN&gt;GIS&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###Variables&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;AGOL_Login = GIS(&lt;SPAN&gt;None, &lt;/SPAN&gt;&lt;SPAN&gt;"Username"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Password"&lt;/SPAN&gt;)&lt;BR /&gt;itemToDownload = AGOL_Login.content.get(&lt;SPAN&gt;"ItemID"&lt;/SPAN&gt;)&lt;BR /&gt;exportLoc = &lt;SPAN&gt;r"Export Path"&lt;BR /&gt;&lt;/SPAN&gt;itemExportName_XL = &lt;SPAN&gt;"RMapFieldData"&lt;BR /&gt;&lt;/SPAN&gt;itemExportName_SHP = &lt;SPAN&gt;"RMap"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;###EXCEL&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;###Export the ArcGIS Online Item&lt;BR /&gt;&lt;/SPAN&gt;itemToDownload.export(itemExportName_XL&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Excel"&lt;/SPAN&gt;&lt;SPAN&gt;, None, True&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###Search for and Get the Newly Exported Item&lt;BR /&gt;&lt;/SPAN&gt;searchForExportedItem = AGOL_Login.content.search(itemExportName_XL)&lt;BR /&gt;exportedItemID = searchForExportedItem[&lt;SPAN&gt;0&lt;/SPAN&gt;].id&lt;BR /&gt;getTheExportedItems = AGOL_Login.content.get(exportedItemID)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###Download the Newly Exported Item&lt;BR /&gt;&lt;/SPAN&gt;getTheExportedItems.download(exportLoc&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"{}.xlsx"&lt;/SPAN&gt;.format(itemExportName_XL))&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###SHAPEFILE&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;###Export the ArcGIS Online Item&lt;BR /&gt;&lt;/SPAN&gt;itemToDownload.export(itemExportName_SHP&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Shapefile"&lt;/SPAN&gt;&lt;SPAN&gt;, None, True&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###Search for and Get the Newly Exported Item&lt;BR /&gt;&lt;/SPAN&gt;searchForExportedItem = AGOL_Login.content.search(itemExportName_SHP)&lt;BR /&gt;exportedItemID = searchForExportedItem[&lt;SPAN&gt;0&lt;/SPAN&gt;].id&lt;BR /&gt;getTheExportedItems = AGOL_Login.content.get(exportedItemID)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;###Download the Newly Exported Item&lt;BR /&gt;&lt;/SPAN&gt;getTheExportedItems.download(exportLoc&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"{}.shp"&lt;/SPAN&gt;.format(itemExportName_SHP))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 19:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035078#M5685</guid>
      <dc:creator>ClintBoaz1</dc:creator>
      <dc:date>2021-03-10T19:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035088#M5687</link>
      <description>&lt;P&gt;I would give it a go without specifying the filename as an argument:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;###Download the Newly Exported Item&lt;BR /&gt;&lt;/SPAN&gt;getTheExportedItems.download(exportLoc)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 19:32:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035088#M5687</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-03-10T19:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035135#M5689</link>
      <description>&lt;P&gt;Hey David,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp; I just tied taking out the arguments as you suggested however after taking them out the .shp file does not export at all.&amp;nbsp; Only the excel file exports, still unregistered.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035135#M5689</guid>
      <dc:creator>ClintBoaz1</dc:creator>
      <dc:date>2021-03-10T20:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035142#M5690</link>
      <description>&lt;P&gt;ah ok, possibly this might help if it's exported as a hosted feature layer&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/download-item-data/td-p/872105" target="_blank"&gt;Download Item Data - Esri Community&lt;/A&gt;&amp;nbsp;but unfortunately I can't test anything, and I'm straying away from my experience. Perhaps:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features.manage_data import extract_data

shapefile = extract_data([getTheExportedItems])
shapefile.download('C:\\outFolder')&lt;/LI-CODE&gt;&lt;P&gt;good luck!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:58:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035142#M5690</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-03-10T20:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035323#M5697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/23535"&gt;@ClintBoaz1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;By putting .shp you are telling python to download just this file and not the other related files (Shapefiles).&lt;/P&gt;&lt;P&gt;The following script should work, you can also specify the save_path and file_name inside the download method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;item_1 = gis.content.get('FL_itemID')
item_shp = item_1.export(title='item_shapefile', export_format='Shapefile')
item_shp.download()
# you can specify the file path and name 
# item_shp.download(save_path=r"D:\temp", file_name="item_downloadedFromAGOL.zip")

item_2 = gis.content.get('FL_itemID')
item_excel = item_2.export(title='item_excel', export_format='Excel')
item_excel.download()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 05:29:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035323#M5697</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-03-11T05:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035501#M5699</link>
      <description>&lt;P&gt;Hey Mehdi,&lt;/P&gt;&lt;P&gt;This worked!&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035501#M5699</guid>
      <dc:creator>ClintBoaz1</dc:creator>
      <dc:date>2021-03-11T15:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Downloading AGOL feature as Excel file and shapefile with Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035772#M5703</link>
      <description>&lt;P&gt;You're welcome&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/23535"&gt;@ClintBoaz1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Glad to hear that!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 00:53:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/downloading-agol-feature-as-excel-file-and/m-p/1035772#M5703</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-03-12T00:53:58Z</dc:date>
    </item>
  </channel>
</rss>

