Researching to see if there is a way to use Python to export multiple tables in a File Geodatabase to a single Excel file. I would like for each sheet name to have the same name as the table.
My current situation is that I ran a Python script to take all the domains a GDB and create a table within the GDB.
The article referenced from:
https://community.esri.com/thread/163889
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">main</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> os
gdb <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"Z:\GIS_Projects\zUpdatesBrian\Scripts\ListDomains\ListDomains.gdb"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="keyword token">for</SPAN> dom <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>ListDomains<SPAN class="punctuation token">(</SPAN>gdb<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> dom<SPAN class="punctuation token">.</SPAN>domainType <SPAN class="operator token">==</SPAN> <SPAN class="string token">'CodedValue'</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DomainToTable_management<SPAN class="punctuation token">(</SPAN>in_workspace<SPAN class="operator token">=</SPAN>gdb<SPAN class="punctuation token">,</SPAN>
domain_name<SPAN class="operator token">=</SPAN>dom<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">,</SPAN>
out_table<SPAN class="operator token">=</SPAN>os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>gdb<SPAN class="punctuation token">,</SPAN> dom<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>
code_field<SPAN class="operator token">=</SPAN><SPAN class="string token">"item"</SPAN><SPAN class="punctuation token">,</SPAN>
description_field<SPAN class="operator token">=</SPAN><SPAN class="string token">"descrip"</SPAN><SPAN class="punctuation token">,</SPAN>
configuration_keyword<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" - domain '{0}' of type '{1}' exported to table"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>dom<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">,</SPAN> dom<SPAN class="punctuation token">.</SPAN>domainType<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" - domain '{0}' of type '{1}' skipped"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>dom<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">,</SPAN> dom<SPAN class="punctuation token">.</SPAN>domainType<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> __name__ <SPAN class="operator token">==</SPAN> <SPAN class="string token">'__main__'</SPAN><SPAN class="punctuation token">:</SPAN>
main<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>