<?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 feature table to an excel file in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398049#M84070</link>
    <description>&lt;P&gt;If you working in ArcGIS Pro, find the table you want in your table of contents in ArcGIS Pro, right click and from the context menu click on Data, the export. Rename the output to go where you want it to be and give it a .csv file extension which you can open it up in excel.&lt;/P&gt;&lt;P&gt;I don't know about #2 unfortunately.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2024 19:12:29 GMT</pubDate>
    <dc:creator>clt_cabq</dc:creator>
    <dc:date>2024-03-19T19:12:29Z</dc:date>
    <item>
      <title>Export feature table to an excel file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398016#M84068</link>
      <description>&lt;P&gt;Hi All, Thanks in advance. Please throw some light on the following:&lt;/P&gt;&lt;P&gt;1 . What is the simplest way to export a feature table content to excel.&lt;/P&gt;&lt;P&gt;2. How can I convert feature Table into html table&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 18:06:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398016#M84068</guid>
      <dc:creator>cadgism</dc:creator>
      <dc:date>2024-03-19T18:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature table to an excel file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398049#M84070</link>
      <description>&lt;P&gt;If you working in ArcGIS Pro, find the table you want in your table of contents in ArcGIS Pro, right click and from the context menu click on Data, the export. Rename the output to go where you want it to be and give it a .csv file extension which you can open it up in excel.&lt;/P&gt;&lt;P&gt;I don't know about #2 unfortunately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 19:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398049#M84070</guid>
      <dc:creator>clt_cabq</dc:creator>
      <dc:date>2024-03-19T19:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature table to an excel file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398059#M84071</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;But I am looking a way to accomplish it in ArcGIS Javascript API&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 19:40:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398059#M84071</guid>
      <dc:creator>cadgism</dc:creator>
      <dc:date>2024-03-19T19:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature table to an excel file</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398069#M84072</link>
      <description>&lt;P&gt;This block of code should create a downloadable csv and add it as a button to a FeatureTable.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function customExportCSV() {
    let query = featureLayer.createQuery()
    query.where = '1=1'
    let csv = ''
    let headers = ''

    featureLayer.queryFeatures(query).then((featureSet) =&amp;gt; {
        headers = Object.keys(featureSet.features[0].attributes).join(',')

        for (let i = 0; i &amp;lt; featureSet.features.length; i++) {
            const data = Object.values(featureSet.features[i].attributes).join(',')
            csv += data + '\n'
        }

        csv = headers + '\n' + csv

        downloadCSV(csv)
    })   
}   

function downloadCSV(csv) {
    const csvFile = new Blob([csv], { type: 'text/csv' });
    const downloadLink = document.createElement("a");
    downloadLink.download = 'search_results.csv';
    downloadLink.href = window.URL.createObjectURL(csvFile);
    downloadLink.style.display = "none";

    document.body.appendChild(downloadLink);
    downloadLink.click();
}  

const downloadButton = new ButtonMenuItem({
    label: 'Download CSV',
    iconClass: 'esri-icon-download',
    clickFunction: customExportCSV,
    autoCloseMenu: true
})

const newTable =  new FeatureTable({
    view: mapView.view,
    layer: featureLayer,
    container: table,
    autoRefreshEnabled: true,
    id: props.key,
    menuConfig: {
        items: [downloadButton]
    }
})&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Mar 2024 20:21:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-feature-table-to-an-excel-file/m-p/1398069#M84072</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2024-03-19T20:21:21Z</dc:date>
    </item>
  </channel>
</rss>

