Illegal Path Error

Hi All,

I am getting an error
image

for the write range activity workbook. I changed the slash also but same error.

image
in_Config(“OutputFilePath”).ToString+now.Date.ToString(“dd-MMM-yyyy”)+“/”+in_TransactionItem(“SubscriptionID”).ToString+in_Config(“NetsuiteExtractedFilename”).ToString

Hi @marina.dutta

Try this

in_Config(“OutputFilePath”).ToString+now.Date.ToString(“dd-MMM-yyyy”)+“\”+in_TransactionItem(“SubscriptionID”).ToString+in_Config(“NetsuiteExtractedFilename”).ToString"+“.xlsx”

@marina.dutta

Please provide the values of variables it is better understanding for us

@marina.dutta

  1. Try using Path.Combine instead of usinng + and slash(/)
  2. Check if there are any characters you used which are jot to be used in path

Cheers

@lrtetala

When I used my way I correctly got the values correctly. Dont know why it gace illegal characters.

image

@marina.dutta

If SubscriptionID is folder then put "\" after SubscriptionID

If NetSuiteExtractedFilename contains .xlsx then dont give it last otherwise add “.xlsx” at last

Once try

in_Config(“OutputFilePath”).ToString+now.Date.ToString(“dd-MMM-yyyy”)+“\”+in_TransactionItem(“SubscriptionID”).ToString+"\"+in_Config(“NetsuiteExtractedFilename”).ToString"+“.xlsx”

@Anil_G @lrtetala

I am getting same error for folder also.

in_Config(“OutputFilePath”).ToString+now.Date.ToString(“dd-MMM-yyyy”)+“"+in_TransactionItem(“SubscriptionID”).ToString+”"

But all these time it was working.The same path was working.

This is my folder structure

@Anil_G

I am getting same error for folder also.

in_Config(“OutputFilePath”).ToString+now.Date.ToString(“dd-MMM-yyyy”)+“"+in_TransactionItem(“SubscriptionID”).ToString+”"

But all these time it was working.The same path was working.

This is my folder structure

@marina.dutta

Try this

in_Config(“OutputFilePath”).ToString+"\"+Now.Date.ToString(“dd-MMM-yyyy”)+“\”+in_TransactionItem(“SubscriptionID”).ToString.Trim()+"\"+in_Config(“NetsuiteExtractedFilename”).ToString+“.xlsx”

You should use Path.Combine instead of a bunch of + signs because Path.Combine takes care of the slashes for you.

Path.Combine(in_Config(“OutputFilePath”).ToString,Now.ToString(“dd-MMM-yyyy”),in_TransactionItem(“SubscriptionID”).ToString,in_Config(“NetsuiteExtractedFilename”).ToString)

Also, it’s Now.ToString not Now.Date.ToString

Also, paths use / not \

@marina.dutta

As mentioned earlier can you please try with path.combine and check

Also please verify your outputfilepath in excel if it has inverted comma in it…if yea remove them

Path.Combine(in_Config("OutputFilePath").ToString,Now.ToString("dd-MMM-yyyy"),in_TransactionItem("SubscriptionID").ToString)

Cheers

Hi @marina.dutta

Try this:

Path.Combine(in_Config("OutputFilePath").ToString,Now.ToString("dd-MMM-yyyy"),in_TransactionItem("SubscriptionID").ToString).ReplaceLineEndings("\")

Hope it helps.

@marina.dutta

Try this

Path.Combine(in_Config(“OutputFilePath”).ToString,Now.Date.ToString(“dd-MMM-yyyy”),in_TransactionItem(“SubscriptionID”).ToString.ReplaceLineEndings(“”),in_Config(“NetsuiteExtractedFilename”).ToString)

@Anil_G

Getting error .

. There is some issue with my subscription Id in_TransactionItem(“SubscriptionID”).

here my SubscriptionID= X0063f000002MaPAAA0

@marina.dutta

Try this:
Path.Combine(in_Config("OutputFilePath").ToString,Now.ToString("dd-MMM-yyyy"),in_TransactionItem("SubscriptionID").ToString).ReplaceLineEndings("\")

@marina.dutta

Did you try with line break replace?

Also it would be good idea to print the string to check what is wrong

Cheers

@marina.dutta

In Create Folder give this

Path.Combine(in_Config(“OutputFilePath”).ToString,Now.Date.ToString(“dd-MMM-yyyy”),in_TransactionItem(“SubscriptionID”).ToString.ReplaceLineEndings(“”))

@lrtetala

@marina.dutta

Give this

Path.Combine(in_Config(“OutputFilePath”).ToString,Now.Date.ToString(“dd-MMM-yyyy”),in_TransactionItem(“SubscriptionID”).ToString.ReplaceLineEndings(“”).ToString)

@marina.dutta

Is it working
If not
Try this

Assign->

SubscriptionID=in_TransactionItem(“SubscriptionID”).ToString.ReplaceLineEndings(“”).ToString

Then use

Path.Combine(in_Config(“OutputFilePath”).ToString,Now.Date.ToString(“dd-MMM-yyyy”),SubscriptionID.ToString)