How to cut a row value after reading and past into another sheet

Hello,
I have a case where I am reading from an Excel file Sheet 1 and after read, I want each row value to be pasted into Sheet 2 one by one.
image

After reading the first value from Sheet 1 it should paste to Sheet 2
image

Then read the second value and should paste it to the next row until all the values are read in Sheet 1
image
When I run it next time it should not overwrite but write to the next blank row in sheet 3.
What I have done:
Read Range Workbook and store in dtRead
For each row in Data-table and pass dtRead
Not sure how to do rest.
(If I use Write range it is copy-pasting the whole row from Sheet 1 to Sheet 2 in one go which is what I don’t want.)

Please advice.

Hello @tyagis!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

I was able to do everything else except not able to figure out how to write to the next cell and not overwrite when running 2nd, 3rd time etc.

Why not? That’s how you’re supposed to do it. Read the source into a datatable, manipulate the data in the datatable, then write the data from the datatable to a spreadsheet all in one shot.

Stop looking at it as editing values in the spreadsheet one at a time or whatever. It doesn’t work like that. Read Range into a DT then work in the DT until you’re ready to write it all back to the spreadsheet.

1 Like

I figured out the whole thing-took some time.
I am supposed to use Write Cell and no Write Range. Also, to write to the next black cell I am counting the rows and adding “+2” to write to the next empty cell.
For Write to Cell and increment by 1 :

coutnernameName = countername + 1
"A" + counterName.ToString

For counting I have (excluding blank)

dtRead2.Rows.Cast(Of DataRow)().Where(Function(row) Not row.Item("Col Name") IsNot DBNull.Value Or row.Item("col Name").ToString() <> "").Count

Thanks for your suggestion.

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