<?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: Join a Feature Layer with a Excel file using arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/join-a-feature-layer-with-a-excel-file-using-arcpy/m-p/1331965#M73393</link>
    <description>&lt;P&gt;Are you getting a successful join that is missing some columns or is it a completely empty output?&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the add join tutorial you are referencing, it does say if you are making a join that doesn't use ObjectIDs you only get a 1 to 1 join based on the first match found. If I recall correctly, hosted feature layers don't really like ObjectIDs so if you are getting a 1:1 join, that is probably why it is happening.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my experience though, I've not ever been able to get arcpy to work with hosted content, so if you're getting empty outputs, or really strange results that might be the problem.&amp;nbsp; I think if you try the add join through the ArcGIS for Python API, you'd have better luck.&amp;nbsp; There's documentation on the tool here with an example farther down the page.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/spatial-analysis/feature-analysis/combine-data/join-features/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/spatial-analysis/feature-analysis/combine-data/join-features/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 13:53:39 GMT</pubDate>
    <dc:creator>TylerGraham2</dc:creator>
    <dc:date>2023-09-25T13:53:39Z</dc:date>
    <item>
      <title>Join a Feature Layer with a Excel file using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/join-a-feature-layer-with-a-excel-file-using-arcpy/m-p/1331938#M73386</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm attempting to perform a join between an existing feature layer containing country boundary polygons and an Excel file. The relationship between these &lt;STRONG&gt;two datasets is one-to-many&lt;/STRONG&gt;. However, when I use the `AddJoin` function from arcpy,&lt;STRONG&gt; the resulting dataset only has a one-to-one join, and the column names in the joined result are not coming from the two original data sources&lt;/STRONG&gt;. I've included a code snippet below for reference, and I'm seeking assistance in understanding what might be incorrect with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;xlsx_file_path = input("Enter the path to the file: ")&lt;/P&gt;&lt;P&gt;file_path=os.path.join(os.getcwd(),"MyProject1.gdb",'data_table'+str(int(dt.datetime.now().timestamp())))&lt;BR /&gt;arcpy.conversion.ExcelToTable(xlsx_file_path, file_path)&lt;BR /&gt;arcpy.MakeTableView_management(file_path, 'table_view2')&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;feature_layer = gis.content.get('b587ef6d8a5b48e382f5fb8f1ccc46ab')&lt;BR /&gt;arcpy.MakeFeatureLayer_management("&lt;A href="https://services7.arcgis.com/yxpZft6sXAxt864n/arcgis/rest/services/countries/FeatureServer/0" target="_blank"&gt;https://services7.arcgis.com/yxpZft6sXAxt864n/arcgis/rest/services/countries/FeatureServer/0&lt;/A&gt;", out_layer='outfeatureLayer')&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;arcpy.management.AddJoin('outfeatureLayer', 'ISO_A3','table_view2', 'ISO_A3','KEEP_COMMON','INDEX_JOIN_FIELDS')&lt;/P&gt;&lt;P&gt;arcpy.CopyRows_management('outfeatureLayer', "C:/new_19.dbf")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also please suggest any other function if it is applicable here. Currently I am refrencing to&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/add-join.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/add-join.htm&lt;/A&gt;&amp;nbsp; tutorial&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Abhishek Kumar Choudhary&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 13:02:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/join-a-feature-layer-with-a-excel-file-using-arcpy/m-p/1331938#M73386</guid>
      <dc:creator>abhishek_595</dc:creator>
      <dc:date>2023-09-25T13:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Join a Feature Layer with a Excel file using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/join-a-feature-layer-with-a-excel-file-using-arcpy/m-p/1331965#M73393</link>
      <description>&lt;P&gt;Are you getting a successful join that is missing some columns or is it a completely empty output?&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the add join tutorial you are referencing, it does say if you are making a join that doesn't use ObjectIDs you only get a 1 to 1 join based on the first match found. If I recall correctly, hosted feature layers don't really like ObjectIDs so if you are getting a 1:1 join, that is probably why it is happening.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my experience though, I've not ever been able to get arcpy to work with hosted content, so if you're getting empty outputs, or really strange results that might be the problem.&amp;nbsp; I think if you try the add join through the ArcGIS for Python API, you'd have better luck.&amp;nbsp; There's documentation on the tool here with an example farther down the page.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/spatial-analysis/feature-analysis/combine-data/join-features/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/spatial-analysis/feature-analysis/combine-data/join-features/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 13:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/join-a-feature-layer-with-a-excel-file-using-arcpy/m-p/1331965#M73393</guid>
      <dc:creator>TylerGraham2</dc:creator>
      <dc:date>2023-09-25T13:53:39Z</dc:date>
    </item>
  </channel>
</rss>

