Paste multiple tables side-by-side in the same excel sheet

Hi team

I have multiple data tables which i want to write in single excel sheet but it should be written in such a manner that 2-3 columns are left between each table
for eg:

so here we can see 4 different tables
in some cases it might be less than 4 or even more
so how can i append tables, column wise leaving a 2 column gap between each table

Dear Aishwarya,

Count the columns of each datatable.
Let us say if you have 3 datatable:
Column count of table1=3
Column count of table2=4
Column count of table3=5

Then in the write Range for table 1:
For first table set it as “A1”

Then in the write Range for table 2:
ASCII value of A =65
table1 column count=3
Skip column count =2

Next Column to start writing Table2 is:
65+3+2=70 ,get the character for value 70 which is Column F, set the write Range from “F1”

Next Column to start writing Table3 is:
table1 column count=3
Skip column count =2
table2 column count=4
Skip column count =2
65+3+2+4+2=76,retreive the char for ASCII value 76 which is Column L,soL1

To get Character for the ASCII value use:
code=ASCII value of letters A-Z
Convert.ToString((char)code)

Thanks,
Geetishree Rao

this is good till the time its just about A-Z but what if it exceeds more than that, that time it wont be reliable

I added the following set of code
ExcelIndexToColumn.xaml (9.3 KB)
and looped it according to my condition and now it is working perfectly fine

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