Use the Open
action in the CSV/TXT package to open a CSV or text file and
specify the delimiter, space trimming, and encoding for use in a bot
workflow.
Before you begin
You must have a bot open in the task editor.
About this task
Use the Open
action to open a CSV or text file for reading in a bot
workflow.Note:
- If a double quotation mark (") is the last element of the
last line of the CSV/TXT file, the bot encounters an error during
runtime.
- When you use the
action to open a CSV file, read it, and assign it to a table, then
write it to a file using the action, the automation interprets any commas in the header or cell
data as delimiters. For instance, if three consecutive cells contain data like
"abc", "bcd",
"efd", the final output will enclose each in triple
double quotes, resulting in """abc""",
"""bcd""", """efd""".
Procedure
-
Double-click or drag the Open
action from the CSV/TXT
package in the Actions palette.
-
Select any of the following options to specify the location of the CSV or text
file to open:
-
Control Room file: Enables you to open a file from the .
-
Desktop file: Enables you to open a file from the device. This field also accepts the file path input as a string variable or global value.
Note: When you enter a file path in the Desktop file field or browse a particular file from the system, wherein the file path is separated by the \ character and save the , the \ character is changed to / as the uses / to separate file paths. Your continue to run successfully even if the \ is changed to / during execution.
-
Variable: Enables you to open a file by specifying a file variable.
The
Open action supports file
streaming. You can use one of the supported actions to create a streamable file
variable and assign the variable to a file available in a cloud storage. This
variable is available only within the current session as global values do not support
streamable file variables. For more information about file stream and supported
packages, see
File streaming using file variable.
-
Turn on the Contains header check box if the file contains
a header row and you want to retrieve values from that row.
-
Select any of the following options to specify the
Delimiter used in the file:
-
Comma
-
Tab
- Regional list separator: Uses the delimiter configured
in the regional settings of the Windows operating system. If the
List Separator in the Windows regional settings is
modified, then the CSV file must also use that character as a delimiter.
-
Newline
- Other: Specifies a custom delimiter other than the
options listed above.
-
Select the Trim leading spaces and Trim trailing
spaces check boxes to remove the leading and trailing spaces from the
data extracted from the CSV/TXT file.
-
Select an option from the Encoding list to specify the
encoding that is applied on the file. Data from the CSV/TXT file will be
retrieved based on the selected encoding option even if the input file has a
different encoding.
- ANSI: Used to encode Latin
alphabet.
- UTF8: Can encode all possible
characters.
- UNICODE: Supports multilingual text
encoding.
-
Win1251: used to encode languages that use the
Cyrillic script, including Bulgarian, Russian, and Serbian.
-
UTF-16LE: ignores the byte order mark (BOM)
Unicode character at the beginning of file.
-
Default: identifies
file encoding. This option supports UTF-8, UTF-16LE, and UTF-16BE file
encoding.
Note: Shift-JIS files must use ANSI
as encoding to read text file content.
-
Click Save.
What to do next
Use the Read action to retrieve data from the
CSV/TXT file and assign it to a table variable. Use the loop action to
retrieve each row from the file or table variable and assign each row to a record
variable for further operations.