Skip to main content

If I have a file path contained in a string variable. How can i convert this file path to a file variable which is selecting the same file. 

The use case is that I am trying to use the PDF actions and for these you have to pass in a “file” variable rather than a file path. In my process the PDF file will be created by the bot in an earlier step but i am only getting the file path as a string at that point. My question is how can i set this file path into a file type variable. 

Hi @ibtasaam ,

 

Below is the supported inline conversion of a String type variable. If I am not mistaken, you can try with the File → Assign action for this. Else, there could be a chance for the same by using any line scripts like Python or JS.

 


@ibtasaam Use File: Assign

 

 


In a nutshell, we cannot convert from string to file variable?

Its common process that the program open the some files using variable.

 


I don’t know if @ibtasaam ‘s original post was fully answered. I, too, had this same issue with sending email attachments. The updated Email package wants a list of type File for the email attachments. I have a list of file names (string), but they are not File objects. The below image illustrates what I needed to do.

  • Acquire a list of file names from the target folder.
  • Loop over that list file name strings
    • Use a variable of type File and use File:Assign to put that file name string
    • Add the file variable to a list of type file (ListOfCompletedFiles)
  • After the loop completes, send that list of type File to the Email package.

Hopefully this provide a full illustration of the process


Reply