<?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: Help loading csv table in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1334221#M10500</link>
    <description>&lt;LI-CODE lang="csharp"&gt;public async Task&amp;lt;Table&amp;gt; CSVtoTable()   //Task&amp;lt;Table&amp;gt;
        {
            Table tbl = null;
            try
            {
                var container = MapView.Active.Map;
                await QueuedTask.Run(() =&amp;gt;
                {
                    string csvPath = "c:\\temp\\test.csv";
                    string tblName = System.IO.Path.GetFileName(csvPath);
                    var StTable = StandaloneTableFactory.Instance.CreateStandaloneTable(new Uri(csvPath, UriKind.Absolute), container);
                    tbl = StTable.GetTable();

                    var tables = container.GetStandaloneTablesAsFlattenedList();
                    if (tables.Count() &amp;gt; 0)  //don't need this
                    {
                        var table = tables.First();
                        if (table.Name == tblName)
                            container.RemoveStandaloneTable(table);
                    }
                    using (RowCursor cur = tbl.Search(null, false))
                    {
                        while (cur.MoveNext())
                        {
                            using (Row row = cur.Current)
                            {
                                string id = Convert.ToString(row["ID"]);
                                Debug.Print(id);
                            }
                        }
                    }
                });
                
            }

            catch (Exception ex)
            {
                ErrorLog(ex.ToString());
                GC.Collect();
                return null;
            }
            return tbl;

        }&lt;/LI-CODE&gt;&lt;P&gt;I figured out how to do what I needed.&amp;nbsp; This returns a Table object.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 17:48:57 GMT</pubDate>
    <dc:creator>Kevin_Andras</dc:creator>
    <dc:date>2023-10-02T17:48:57Z</dc:date>
    <item>
      <title>Help loading csv table</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333642#M10491</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am in the early stages of converting a very large ArcGIS Desktop Add-In&amp;nbsp; to the Pro SDK.&amp;nbsp; &amp;nbsp;My&amp;nbsp; add-in requires loading of .csv files that are generated by external executables.&amp;nbsp; These tables have values that ultimately get appended to feature class tables.&amp;nbsp; I can't figure out how to load .csv files.&amp;nbsp; Any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 00:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333642#M10491</guid>
      <dc:creator>Kevin_Andras</dc:creator>
      <dc:date>2023-09-29T00:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help loading csv table</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333656#M10493</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can load your csv data to featureclass using geoprocessing. Code from ArcGIS Pro SDK Community sample:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;      //args for GP Tool
      string input_table = @"C:\Users\uma2526\Documents\ArcGIS\Projects\CustomItemTest\AlaskaCitiesXY.csv";
      var gbd = Project.Current.GetItems&amp;lt;GDBProjectItem&amp;gt;().FirstOrDefault().Path;
      string outputFC = $@"{gbd}\AlaskaCitiesPointConv";
      string XField = "POINT_X";
      string YField = "POINT_Y";
      var sr = MapView.Active.Map.SpatialReference;
      
      var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
      var cts = new CancellationTokenSource();

      //Make the GP Tool arg array
      var args = Geoprocessing.MakeValueArray(input_table, outputFC, XField, YField, "", sr);
      //Execute
      _ = await Geoprocessing.ExecuteToolAsync("XYTableToPoint_management", args, environments, cts.Token,
                        (eventName, o) =&amp;gt;
                        {
                          System.Diagnostics.Debug.WriteLine($@"GP event: {eventName}");
                        }, GPExecuteToolFlags.None); //No action is taken, so the new Feature class doesn't get added to the map&lt;/LI-CODE&gt;&lt;P&gt;Sample is &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/AddToMapCustomItem" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 05:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333656#M10493</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-29T05:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help loading csv table</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333800#M10496</link>
      <description>&lt;P&gt;The answer depends on what you want to do with the data. The reply by&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133" target="_self"&gt;&lt;SPAN class=""&gt;GintautasKmieliauskas&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;creates a data source for immedate use with a GP processing. However, if you are just reading a text file into an array to concatenate data, as you mention in your post, you can do it all with standard C# coding. This could be done with the basic old readline, writeline of C or in a modern way using the DataTable data type. If reading from a SQL database table vs. ascii flie suggest using System.Data.SqlClient methods. Simple example at&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/6073382/how-to-read-sql-table-data-into-a-c-sharp-datatable" target="_blank" rel="noopener"&gt;.net - How to read SQL Table data into a C# DataTable - Stack Overflow&lt;/A&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333800#M10496</guid>
      <dc:creator>RichardDaniels</dc:creator>
      <dc:date>2023-09-29T16:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help loading csv table</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333924#M10497</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; The standard C# method should work...not sure why I never thought of that.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the old ArcMap SDK it was easy to get an ITable object from a .csv or .dbf file using TextFileWorkspaceFactory or&amp;nbsp;IWorkspaceFactory.&amp;nbsp; Then I could just step through the table using a cursor.&amp;nbsp; &amp;nbsp;I was hoping to be able to replicate that.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic76800.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic76800.html&lt;/A&gt;&amp;nbsp;describes how to create a StandAloneTable, but that's probably more than I need, since I don't need to put it in a container.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 23:11:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1333924#M10497</guid>
      <dc:creator>Kevin_Andras</dc:creator>
      <dc:date>2023-09-29T23:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help loading csv table</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1334221#M10500</link>
      <description>&lt;LI-CODE lang="csharp"&gt;public async Task&amp;lt;Table&amp;gt; CSVtoTable()   //Task&amp;lt;Table&amp;gt;
        {
            Table tbl = null;
            try
            {
                var container = MapView.Active.Map;
                await QueuedTask.Run(() =&amp;gt;
                {
                    string csvPath = "c:\\temp\\test.csv";
                    string tblName = System.IO.Path.GetFileName(csvPath);
                    var StTable = StandaloneTableFactory.Instance.CreateStandaloneTable(new Uri(csvPath, UriKind.Absolute), container);
                    tbl = StTable.GetTable();

                    var tables = container.GetStandaloneTablesAsFlattenedList();
                    if (tables.Count() &amp;gt; 0)  //don't need this
                    {
                        var table = tables.First();
                        if (table.Name == tblName)
                            container.RemoveStandaloneTable(table);
                    }
                    using (RowCursor cur = tbl.Search(null, false))
                    {
                        while (cur.MoveNext())
                        {
                            using (Row row = cur.Current)
                            {
                                string id = Convert.ToString(row["ID"]);
                                Debug.Print(id);
                            }
                        }
                    }
                });
                
            }

            catch (Exception ex)
            {
                ErrorLog(ex.ToString());
                GC.Collect();
                return null;
            }
            return tbl;

        }&lt;/LI-CODE&gt;&lt;P&gt;I figured out how to do what I needed.&amp;nbsp; This returns a Table object.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/help-loading-csv-table/m-p/1334221#M10500</guid>
      <dc:creator>Kevin_Andras</dc:creator>
      <dc:date>2023-10-02T17:48:57Z</dc:date>
    </item>
  </channel>
</rss>

