Open an excel file and rename the file for a specific cell value

The report has multiple sheets but I only need to pull the file name from cell B6 in the first sheet.

1 Like

Ok…

If it’s always the first sheet, use “Get Workbook Sheets” activity and take the first item of the list (index 0)

1 Like

How do I go about taking the index 0?

Here is my workflow, how do you think that it looks?

Thanks for all of your help so far!

1 Like

Set a variable in the Output “Sheets” field (Get Workbook Sheets). Name it as sheetNames.

Then, in the “read range” activity instead of using “”, use sheetNames(0)

1 Like

OK, now for my last issue… :expressionless:

In some cases the cell may be blank, I believe this is why I am getting the error pasted below. I tried to handle this with an IF statement but I still get the same error. If the file is blank the name, the file name could remain the same.

I tried using this multiple assign under IF > ELSE and I received the error below. I tried using the multiple assign under IF>THEN and I received and error under the Copy file section. I believe the multiple assign is supposed to be under else.

Multiple Assign: Can not assign ‘strSearchConditions.Substring(strSearchConditions.IndexOf(“Cust. NM=”)+9, 2)’ to ‘strCustomerName’.

Do you have any suggestions for this issue?

1 Like

No worries… I am here to help you, feel free to share issues you’re facing

Just checking…

So, you read all cells from B1 to B6. If all of them have a content (different of blank) you’ll rename the file. Otherwise, you won’t

Am I correct?

1 Like

Well, I was trying to read range B1 & B6 but in order to avoid a more complex problem, I then decided to just read cell B6. If content exists the file should be renamed. If content does not exist the file can remain the same.

1 Like

Got it,

But to rename it, you need other cell values, don’t you?

1 Like

Yes, I am trying to rename the cells based on data within cell B6

Example: Cell B6 contains the Customer name > Extract Customer name > Rename file for Customer Name

1 Like

Got it…

So, when you used Read Range activity you set an output variable, let’s say cellValue.

After that, use an if activity. If it’s not empty it follows to assign and copy file. Otherwise, it doesn’t do anything.

image

IMPORTANT NOTE: I used cellValue(0)(0) because in your Read Range activity you informed only one cell

1 Like

I received the same error using this workflow

Multiple Assign: Can not assign ‘strSearchConditions.Substring(strSearchConditions.IndexOf(“Cust. NM=”)+9, 2)’ to ‘strCustomerName’.

1 Like

Okay…

Replace sheetNames by another variable (the one in output field of Read Range activity)

image

1 Like

Also, copy file should be in the “Then” branch. Just after the assign activity

1 Like

I receive the same error after updating the. I used “SheetOutput” as the output variable from the read range activity

Not(String.IsNullOrEmpty(SheetOutput(0)(0).toString))

1 Like

Okay,

Now, probably is something related to the manipulation you’re doing.

Share more details about the values you’re trying to attribute in the assign activity.

Also, share a sample of the content in cell B6

1 Like

I am also using a multiple assign activity, I record 2 values from cell B6 and then rename the file with those two values.

strCustomerName = strSearchConditions.Substring(strSearchConditions.IndexOf(“Cust. NM=”)+9, 2)

strAffiliate = strSearchConditions.Substring(strSearchConditions.IndexOf(“S.Affi=”)+7, 2)

strCustomerFilename = “C File location” + strReportType + “" + strCustomerName + "” + strAffiliate + “.xlsm”

1 Like

What’s the value of strSearchConditions? Shouldn’t you use “SheetOutput”?

What about strReportType?

1 Like

If you want to connect to solve this last issue…

ping me on gustavo.cervelin@gmail.com

1 Like

I was able to connect with Gustavo who helped me solve my complex issue quickly. Thank you for the support.

Hi @MF.RPA,

Thanks and I’m glad it helped you.

Kindly mark one of my answers as solution (it isn’t the like button, it’s the green check icon)

Have a good day :slight_smile:

1 Like