Skip to main content

I have a bot that accepts a Data Table as an input.  I need to loop through the Data Table and get both the column names as well as the cell values so I can craft a JSON body.  Getting the cell values is straightforward however I cannot figure out how to get the column names.  Any tips?

are you sure the data table is getting passed in with column names?  this may not be very eligant but if you write the file to a csv or txt file and the open the file without the “contains header checked” then the first record will contain the column names.

 

 


I also see that the basic excel has a get column name function so perhaps you write the data table to csv open in with basic excel (which is a light weight excel reader) and use get column name function followed by a loop for the values.

 


Appreciate those suggestions!  Ultimately I suppose I could just add the column names as the first row of data and handle that logic.  Kind of a weird hoop but it works!  Thank you!


In case you have an option to use csv:

Just imported a csv to a data table and the first row was only headers. Screen shot shows data in first 3 columns at row index 0. 

Hope this helps!


Reply