I am trying to download an existing AGOL feature layer to a local server as both an excel file and shapefile using python. 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. 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. How can I replicate this with python? I am new to AGOL and python 3. Here is my code:
import arcgis
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True
from arcgis.gis import GIS
###Variables
AGOL_Login = GIS(None, "Username", "Password")
itemToDownload = AGOL_Login.content.get("ItemID")
exportLoc = r"Export Path"
itemExportName_XL = "RMapFieldData"
itemExportName_SHP = "RMap"
###EXCEL
###Export the ArcGIS Online Item
itemToDownload.export(itemExportName_XL, "Excel", None, True)
###Search for and Get the Newly Exported Item
searchForExportedItem = AGOL_Login.content.search(itemExportName_XL)
exportedItemID = searchForExportedItem[0].id
getTheExportedItems = AGOL_Login.content.get(exportedItemID)
###Download the Newly Exported Item
getTheExportedItems.download(exportLoc, "{}.xlsx".format(itemExportName_XL))
###SHAPEFILE
###Export the ArcGIS Online Item
itemToDownload.export(itemExportName_SHP, "Shapefile", None, True)
###Search for and Get the Newly Exported Item
searchForExportedItem = AGOL_Login.content.search(itemExportName_SHP)
exportedItemID = searchForExportedItem[0].id
getTheExportedItems = AGOL_Login.content.get(exportedItemID)
###Download the Newly Exported Item
getTheExportedItems.download(exportLoc, "{}.shp".format(itemExportName_SHP))