<?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: Tool to Select Multiple Layers, Export to Single Excel with multiple worksheets in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1200513#M14801</link>
    <description>&lt;P&gt;One idea/option is to publish the Tool you've created as a new Geoprocessing Service onto your ArcGIS Server site, at that point it's just a REST endpoint that you can execute from just about anything that has web access.&amp;nbsp; We do this in some of our WAB widgets with the javascript api's &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/geoprocessor-amd.html" target="_self"&gt;Geoprocessor task&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 18:22:27 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2022-08-08T18:22:27Z</dc:date>
    <item>
      <title>Tool to Select Multiple Layers, Export to Single Excel with multiple worksheets</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1194062#M14794</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;We have created a gp tool (using Python) to select features from multiple layers, export them to individual CSV files, then combine them as separate worksheets in an Excel workbook. Works great locally in ArcMap, then after publishing, and bringing into WAB for Poral, it errors out due to limitations of the WAB Portal environment.&lt;/P&gt;&lt;P&gt;Is this a functionality that can be used in the Enhanced Search widget?&lt;/P&gt;&lt;P&gt;If not, is this easy enough to do in JavaScript? Below is the code for a Python solution, which is very simple:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;##Import Modules&lt;/EM&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;import glob, os&lt;BR /&gt;import pandas as pd&lt;BR /&gt;import xlsxwriter&lt;BR /&gt;from pandas import DataFrame, ExcelWriter&lt;BR /&gt;import csv&lt;/P&gt;&lt;P&gt;&lt;EM&gt;##Allow outputs to be overwritten&lt;/EM&gt;&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# CSV Locations folder path&lt;/EM&gt;&lt;BR /&gt;csv_Output_dir = arcpy.env.scratchFolder&lt;/P&gt;&lt;P&gt;&lt;EM&gt;## Get names of layers that have been selected&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;## If features from multiple layers are selected, a List is returned, separated by semicolon&lt;/EM&gt;&lt;BR /&gt;in_featureclassInputs = arcpy.GetParameterAsText(0)&lt;BR /&gt;arcpy.AddMessage("Input Layer Names: " + str(in_featureclassInputs+"\n"))&lt;/P&gt;&lt;P&gt;&lt;EM&gt;## Loop through each layer in List to create individual CSV files&lt;/EM&gt;&lt;BR /&gt;for FeatClass in in_featureclassInputs.split(';'):&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;EM&gt;## Strip out unnecessary quotes and slashes&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;FeatClassStripped = FeatClass.replace("'","")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CSV_Name = FeatClassStripped.split("\\")[-1]+".csv"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;EM&gt;##Arcpy table conversion tool being used here&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;arcpy.conversion.TableToTable(in_rows=FeatClassStripped, out_path=csv_Output_dir,&amp;nbsp; &amp;nbsp; &amp;nbsp;out_name=CSV_Name)&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;### Create Excel File and Combine CSVs into it&lt;/EM&gt;&lt;BR /&gt;Excel_workbook = pd.ExcelWriter(arcpy.env.scratchFolder+"\GIS_Asset_List.xlsx", engine='xlsxwriter')&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for csv_file in glob.glob(os.path.join(arcpy.env.scratchFolder, '*.csv')):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;read_file = pd.read_csv(csv_file)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;sheetTitle = csv_file.split("\\")[-1].replace(".csv","")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;read_file.to_excel (Excel_workbook, sheet_name=sheetTitle)&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;## Save Excel Workbook and create link for Excel download&lt;/EM&gt;&lt;BR /&gt;Excel_workbook.save()&lt;BR /&gt;arcpy.SetParameterAsText(1, arcpy.env.scratchFolder+"\GIS_Asset_List.xlsx"&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 17:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1194062#M14794</guid>
      <dc:creator>smevans88</dc:creator>
      <dc:date>2022-07-20T17:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Tool to Select Multiple Layers, Export to Single Excel with multiple worksheets</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1200513#M14801</link>
      <description>&lt;P&gt;One idea/option is to publish the Tool you've created as a new Geoprocessing Service onto your ArcGIS Server site, at that point it's just a REST endpoint that you can execute from just about anything that has web access.&amp;nbsp; We do this in some of our WAB widgets with the javascript api's &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/geoprocessor-amd.html" target="_self"&gt;Geoprocessor task&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 18:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1200513#M14801</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-08-08T18:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Tool to Select Multiple Layers, Export to Single Excel with multiple worksheets</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1201448#M14805</link>
      <description>&lt;P&gt;Thanks James. This actually seems doable. I will start looking at this solution and provide updates. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 17:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1201448#M14805</guid>
      <dc:creator>smevans88</dc:creator>
      <dc:date>2022-08-10T17:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Tool to Select Multiple Layers, Export to Single Excel with multiple worksheets</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1244873#M14852</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;I am attempting to do what you say with a simple GP model that exports features to shapefiles. It works fine in Pro, and allows me to publish it as a service. However, when I use that service in the WAB GP tool my input and output parameters fail to show. How do I expose these?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ahargreaves_FW_0-1672755681561.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59618iAF43D3DBA3E6C99E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ahargreaves_FW_0-1672755681561.png" alt="ahargreaves_FW_0-1672755681561.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ahargreaves_FW_1-1672755706095.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59620i7F44B194207049D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ahargreaves_FW_1-1672755706095.png" alt="ahargreaves_FW_1-1672755706095.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 14:21:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/tool-to-select-multiple-layers-export-to-single/m-p/1244873#M14852</guid>
      <dc:creator>ahargreaves_FW</dc:creator>
      <dc:date>2023-01-03T14:21:52Z</dc:date>
    </item>
  </channel>
</rss>

