Write range workbook activity sheet error

Hello all,
As I need to write the data in an excel with each sheet dynamically. but in write range workbook activity I’m getting an error like “Write Range Workbook: Worksheet names cannot contain any of the following characters: :/?*”. How to sort it? I have given files manually so that It can create newly.

Hi @ISBS_ROBOT ,
This error show that your sheet name is not found
→ you can check sheet name correct
default is “sheet1”
you can get dynamic by index
get work sheet → return sheet name as String
write to sheet “String”
regards,
LNV

Hi,
Can you try to the following expression?

System.Text.RegularExpressions.Regex.Replace(yourSheetName,"[:\\\?\[\]/*]","")

Regards,

I have given File name- “Filter.xlsx”
Sheet name- CurrentRow(“POLICY_NUMBER”).ToString
There’s no space or special character to replace

Hi,

For investigating, can you check and share the result of the following expression using WriteLine or Messagebox?

String.Join(",",CurrentRow("POLICY_NUMBER").ToString.Select(Function(c) AscW(c)))

Regards,

Here’s the result “Write Range Workbook: Worksheet names cannot be more than 31 characters”.
Actually my process is From an excel file I need to separate the data based on policy numbers contains duplicates. In for each row I took filter data table activity matching policy number column. and want to write the data in new file with sheet name as for each policy number

My intent is that the expression is used in Messagebox or WriteLine. Can you try this and share the result?

image

Regards,

Hello, Please check the attached image as result.

Hi,

Thank you for sharing. This shows the string is 2.511005050211E+17. And in my environment, it’s no problem to use it as sheet name. After this messagebox, does error occurs in WriteRangeActivity?

Regards,

Yes, the same error as mentioned above. write range cannot contain special characters…

To isolate cause, can you try the following?

1.When error occurs in debug mode, output content of CurrentRow("POLICY_NUMBER").ToString using Immediate panel as the following.

image

  1. Check if error occurs if use "2.511005050211E+17" instead of CurrentRow(“POLICY_NUMBER”).ToString

Regards,

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