How do i check if the excel sheet is empty and if it is empty keep moving to the next sheet until a specify company

Hi, im trying to figure out how do i check if the excel sheet is empty and if it is empty keep moving to the next sheet until a specify company is found after that copy the data in the sheet and paste it to another specify company in the sheet all these is done in the same file

Here is a screenshot of my progress so far

You can use Get Workbook Sheets get all the sheet name, then use For Each to loop the sheet name

1 Like


Could you please send the sample excel file ,is the company means the sheet name or is the data present inside the sheet.

The company means the sheet name License List sample.xlsx (90.2 KB)

The data is present the thing i need to do is copy from a specify company and paste the data in another company

  1. In excel application scope property there was as property called workbook crarte a variable in it.(let’s assume variable name as WB)
  2. Use for each in value give WB.getsheets it will give all the sheet names in a collection
  3. Inside for each put an if condition and check if the sheet name equals to what company name you want.
    4.if it matches in then use read range and store it in datatable.
  4. And again do the same process for finding the company name sheet you want to paste and use append range or write range to paste the data.

Get sheet name for reference


What is the variable type for this WB?



You can just create the variable by using ctrl+k in the output field it will automatically assign variable type

Thanks that fixed it so for the if function the condition to find the specify company do i need to create a data table to find it ?

No it will be a string datatype which will come from for each activity…

Wait now how do i know if the excel sheet has data then it will copy else find another company. So far im able to copy n paste it to the company i want already i know xxxx.Rows.count > 0 works but im not sure where to put it or there is another way

your solution would be a good one for checking whether the datatable contains data or not


Did the issue got fixed?

Yes, kind of but now i want to copy n paste into the last row of a cell and continue in future too do you know how?

Use append range it will write the data after the last row.


Thanks for the help guys, it helped alot. If i got questions again i will post on a new one !

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