Question

unable to insert column in Data table

  • 12 January 2024
  • 6 replies
  • 180 views

Badge +3

I am trying to insert column into a data table, but I am not sure why it is not working. 
Please let me know what needs to be done.

 

trying to read excel into data table



 

trying to insert column into the table



 


6 replies

Userlevel 3
Badge +7

@lathab ,

Looks like you are trying to read the excel data using excel advance package and the the insert column is performed through Data table package. This won’t work. To insert into the excel you’ll have to make use of same excel advance Insert column. The action is called “Insert/Delete rows/column”.

 

Userlevel 7
Badge +13

Hi @lathab ,

 

Could you please share the screenshot of your code as well?

 

 

I tried to replicate your case and it is working at my side.

 

Input File

 

Data Table after adding STATUS column

 
Userlevel 2
Badge +8

@Padmakumar in his original post he wants to insert into the data table not excel (if I’m understanding the question right).

@lathab your code looks good to me. I just finished a project where we’re doing the same thing but loading from both csv and Excel into separate data tables. Although we are using the “Get Multiple Cells” action instead. Add some verification that the data ended up in your data table. Get the number of columns and number of rows into variables and output to a log file or a message box. Perhaps if your excel sheet doesn’t have any data then there’s no table to add a column into.

Userlevel 7
Badge +13

@Padmakumar in his original post he wants to insert into the data table not excel (if I’m understanding the question right).

@lathab your code looks good to me. I just finished a project where we’re doing the same thing but loading from both csv and Excel into separate data tables. Although we are using the “Get Multiple Cells” action instead. Add some verification that the data ended up in your data table. Get the number of columns and number of rows into variables and output to a log file or a message box. Perhaps if your excel sheet doesn’t have any data then there’s no table to add a column into.

 

@JMarino I hope you have gone through his post. He has mentioned “Inserting Column to Data Table”. Since he is converting Excel as Data Table in the first step, what is the point of adding Column to the Excel sheet again?

 
 
Userlevel 2
Badge +8

@Padmakumar I misunderstood your reply. Looks like you also suggested that his code should be working.

Userlevel 5
Badge +9

@lathab

 

I performed the same test and it works fine. Try adding a value in the column fields and check if that is the expected output.

 

HTH

 

Regards

Reply