<?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: Export Attachments - Without a Feature Layer and Multiple _ATTACH Tables in Geodatabase in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611263#M62390</link>
    <description>&lt;P&gt;There might be more elegant ways of doing it, but you could just modify the script you linked to export all 25 attachment tables at once. Just copy and paste lines 5-17 over and over again, and just modify your inTable and fileLocation variables. Notice how I changed&amp;nbsp;inTable&lt;STRONG&gt;1&lt;/STRONG&gt; = arcpy.GetParameterAsText(&lt;STRONG&gt;0&lt;/STRONG&gt;) in line 5 to&amp;nbsp;inTable&lt;STRONG&gt;2&lt;/STRONG&gt; = arcpy.GetParameterAsText(&lt;STRONG&gt;3&lt;/STRONG&gt;) in line 19. You'll also need to change the corresponding variables that are referenced in the code as well.&lt;/P&gt;&lt;P&gt;And then when you create your tool, you'll just create 25 user inputs. If your output location is going to be the same for every attachment table, you would just create that variable once and wouldn't have to create a copy of it for each attachment table.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy import da
import os

inTable1 = arcpy.GetParameterAsText(0)
fileLocation1 = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable1, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation1 + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment

inTable2 = arcpy.GetParameterAsText(2)
fileLocation2 = arcpy.GetParameterAsText(3)

with da.SearchCursor(inTable2, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation2 + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2025 19:51:28 GMT</pubDate>
    <dc:creator>RyanUthoff</dc:creator>
    <dc:date>2025-05-02T19:51:28Z</dc:date>
    <item>
      <title>Export Attachments - Without a Feature Layer and Multiple _ATTACH Tables in Geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611247#M62388</link>
      <description>&lt;P&gt;Hello Everyone&lt;/P&gt;&lt;P&gt;We have created a survey that is being used to collect photographs at different points throughout our study area. We have a geopoint question, but that is only used for navigational purposes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We had a test round of data collection a couple of weeks ago and are now downloading the data. The issue that we are running into is that each photo site has its own repeat, so we have 25 _ATTACH tables in our .gdb.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Survey123_02.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131382iF8F064B68676B086/image-size/large?v=v2&amp;amp;px=999" role="button" title="Survey123_02.png" alt="Survey123_02.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have created a script based on the Python code referenced in this demonstration below:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/knowledge-base/how-to-batch-export-attachments-from-a-feature-class-in-000011912" target="_blank"&gt;https://support.esri.com/en-us/knowledge-base/how-to-batch-export-attachments-from-a-feature-class-in-000011912&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But, the issue that I am running into is that I am only allowed to enter one _ATTACH table at a time. Is there a way I can do a batch export based on there being multiple _ATTACH tables in the .gdb? Otherwise, I suppose my easier, but time consuming option, would be to just run the Export Attachments tool.&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 19:16:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611247#M62388</guid>
      <dc:creator>GarrettRSmith</dc:creator>
      <dc:date>2025-05-02T19:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export Attachments - Without a Feature Layer and Multiple _ATTACH Tables in Geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611262#M62389</link>
      <description>&lt;P&gt;You could make an array of your table names, and do a for loop for each of the tables in the array.&lt;/P&gt;&lt;P&gt;PhotoTbls = [ "PhotositeUP02_Attach", ""PhotositeUP03_Attach",....]&lt;/P&gt;&lt;P&gt;for PT in PhotoTbls:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;your script here&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 19:43:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611262#M62389</guid>
      <dc:creator>Neal_t_k</dc:creator>
      <dc:date>2025-05-02T19:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Export Attachments - Without a Feature Layer and Multiple _ATTACH Tables in Geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611263#M62390</link>
      <description>&lt;P&gt;There might be more elegant ways of doing it, but you could just modify the script you linked to export all 25 attachment tables at once. Just copy and paste lines 5-17 over and over again, and just modify your inTable and fileLocation variables. Notice how I changed&amp;nbsp;inTable&lt;STRONG&gt;1&lt;/STRONG&gt; = arcpy.GetParameterAsText(&lt;STRONG&gt;0&lt;/STRONG&gt;) in line 5 to&amp;nbsp;inTable&lt;STRONG&gt;2&lt;/STRONG&gt; = arcpy.GetParameterAsText(&lt;STRONG&gt;3&lt;/STRONG&gt;) in line 19. You'll also need to change the corresponding variables that are referenced in the code as well.&lt;/P&gt;&lt;P&gt;And then when you create your tool, you'll just create 25 user inputs. If your output location is going to be the same for every attachment table, you would just create that variable once and wouldn't have to create a copy of it for each attachment table.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy import da
import os

inTable1 = arcpy.GetParameterAsText(0)
fileLocation1 = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable1, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation1 + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment

inTable2 = arcpy.GetParameterAsText(2)
fileLocation2 = arcpy.GetParameterAsText(3)

with da.SearchCursor(inTable2, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation2 + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 19:51:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/export-attachments-without-a-feature-layer-and/m-p/1611263#M62390</guid>
      <dc:creator>RyanUthoff</dc:creator>
      <dc:date>2025-05-02T19:51:28Z</dc:date>
    </item>
  </channel>
</rss>

