Read data from .txt using variable


I’d like to read data from text file using variable . I’d like filepath to be passed using variable so I’d created respective flow where:

input dialog has variable name2 as output

I pass this to the file read box and receive error. Any chance you could explain me why i recieve. Variable is type string so no issue should appear

Can you please upload XML or attach the screenshot of your flow along with the value that you are passing as the argument.

Seems like to me that the filepath is wrong when it hits the Read Text File activity. I would check that. Maybe use a message box to display the filepath variable before it goes to the Read Text.

I cannot upload one than more pictures so I will describe my flow

I am using two variables:

name1 string to pass the content of file path
name2 string to pass name of file to be opened

Input dialogbox: Input->title = name2 Output: Result: name2

Read text file dialogbox Input: Filename->name2 Output: content->name1

Msgbox contend->name1

below screensot of the flow:

I tried to do exactly the same using CSV file and error which popped up told more information:

according to this info the filepath contain invalid caracters. It says spacebar was used. This is weird as I do not have any spacebar in the path. Below the filepath:


Upload the XML.

Main.xaml (8.5 KB)
project.json (245 Bytes)

Looking at the XML that you have uploaded the possible issue could be, that you typing the wrong path in the input dialogue box.

A better approach for creating folders/file dynamically will be this.

Here Folderlocation is a variable which stores the location of you folder. This is the expression i have used to create folder with specific names :

Here MailSavedbyBot is my root directory where I want my new folders with the specific name to be created.

once you have made your Bot to traverse the location where you want to check for a particular file then use Path exists activity to check for that file. if you know the name of the file to be checked, then you can hard code it, or else you can create an input message window where you can give the name of the file and later on pass it as a variable.

1 Like

thanks for solution! Q: how you pass variable 'sendername" cause that is causing issue in my case.