How to read a worksheet and replace another worksheet's column within the same workbook?

Hello Good People,

Need your guidance with this use case:

  • Read an excel sheet.
    Input.xlsx (9.7 KB)

  • Update the other excel sheet with one of the column for the first worksheet without have any overlapping data.

The reason as to why am stressing the point of not having any overlapping data is because the data varies yet am working with a template.
I’ve attched a sample file of the scenario.

Thank you in advance.

Best Regards,
Kakooza Allan Klaus

Hey @Kakooza-Allan-Klaus,

For this scenario what you can do is,

  1. Read datatable from sheet 1.
  2. Create a parametrized macro to add the number of column and invoke it and pass the number of column from the datatable 1, so that the macro can create that much columns in the target sheet so the already exists columns won’t be overlapped.
  3. Use write range and in range pass “A1” to write the datatable.

Thanks,
Sanjit

1 Like

Am actually just replacing what’s to provide more context:

Considering the the input file I shared:
Read data in column A sheet1.
Replace data in column A sheet2 with data from column A sheet1 .

That’s it hope it is clear enough.

ReplaceCoumn1FromSheet2WithColumn1Sheet1.xaml (5.0 KB)

Hey @Kakooza-Allan-Klaus,

PFA the solution, let me know if it is helpful.

Thanks,
Sanjit

1 Like

Thanks bro,

I managed to kind of achieve what I wanted by adding an assign activity with defaultView and filtering out desired column but it doesn’t give me what I want completely because am dealing with a template and the data varies with the quantity so what should I do in an event of having the rest data that I don’t want to deal with how can I delete the remaining data.

Hope it is clear

image

That’s what resolved the issue.

1 Like

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