Picture names cannot contain any of the following characters: :\/?*[]

Hi All,

Read Range : Picture names cannot contain any of the following characters: :/?*

I have removed the picture from the file still getting this error.

Regards,
Vishal

@Vishal_Kumar4

Use Rename file activity to replace the picture name

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

image
My Input:

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

Hi @Vishal_Kumar4

The below threads should help you

Regards

Already tried these. But no success. Excel app scope taken too much time to read the data.

@Vishal_Kumar4

Can you try my above approach

Hi @Vishal_Kumar4

Do you large amount of data in excel. As this issue has those solutions. If possible share the screenshot of the excel @Vishal_Kumar4

Regards

I didn’t understood how the name will get replace.

Yes i have large data in that sheet

Hi @Vishal_Kumar4

In that case Macros will work for you in replacing those special characters if possible share the excel file. I will help you out with macros since Macros will get less time to execute

Regards

@Vishal_Kumar4

Is Picture is a column name can you make a screenshot of your input.If it is Sensitive information then put a sample input.

Can you give a try using my regex Expression it works pass your Input and put my regex expression.Use For each loop to iterate over your datatable.If you are using excel application scope then use For each row

CurrentRow("PictureName")=System.Text.RegularExpressions.Regex.Replace(CurrentRow("PictureName").ToString,"[\\\/\?\*\[\]]","")

Hi @Vishal_Kumar4

Place the below code in text file

Sub ReplaceCharacters()
    Dim ws As Worksheet
    Dim rng As Range
    Dim cell As Range
    Dim str As String
    Dim i As Integer
    
    ' Loop through all worksheets in the workbook
    For Each ws In ThisWorkbook.Worksheets
        ' Define the range of cells in the current worksheet
        Set rng = ws.UsedRange
        
        ' Loop through each cell in the range
        For Each cell In rng
            str = cell.Value
            For i = 1 To Len(str)
                Select Case Mid(str, i, 1)
                    Case ":", "\/", "?", "*", "[", "]"
                        Mid(str, i, 1) = ""
                End Select
            Next i
            cell.Value = str
        Next cell
    Next ws
End Sub

Keep Show Excel Window property in Excel Process Scope as False, so that it won’t open excel at run time.

Regards

Well i had to manually check for each picture in the file using the Selection panel. I found out that there was an image place holder with some random name.

After removing this the issue is resolved now.