How to extract sql output to excel

Hi Team,

My scenario is i have one sql which fetches result as count. i need to run this sql multiple time but with different columns. So i have input excel file which has all column names and i am passing this excel as input to sql using varaible with for loop.

when i run this process system is sucessfully executing my slq with different columsn and displaying a message box for each run.

Now i need to store output of this edit sql in excel (Note: Output of edit sql is Datatable)

ri used write range but system is storing in only one particuler cell and deletiing and storing in same cell but i need to iterate this and need output in each cell.

can anyone help me with any logic

Before you use write range Try to build one data table and update that Data table with the output of SQL Query and then try to write it to Excel.


Hi i tried above approach but still write range is not getting iterated as it is storing data in same cell.

But i tired to stored output of sql to sql to output datatable and stored the text output to one varaible using assign and in order to iterate the cell i used assign activity with rowindex=rowindex +1 and updated write cell to ā€œCā€ + rowindex.tostring and now i am able to get output of sql storing in each cell.

Thank You.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.