robotframework-csvlibrary

raw JSON →
0.0.5 verified Mon Apr 27 auth: no python

Robot Framework library for reading and writing CSV files (with DotDict support). Current version 0.0.5, released 2025-01-05. Low maintenance cadence.

pip install robotframework-csvlibrary
error ModuleNotFoundError: No module named 'robotframework_csvlibrary'
cause Importing in Python instead of Robot Framework's Library setting.
fix
In your .robot file, use 'Library CSVLibrary' instead of Python import.
error AttributeError: 'list' object has no attribute 'first_name'
cause Using DotDict syntax on a list returned by 'read csv file to list' (returns list of lists).
fix
Use 'read csv file to associative' to get DotDicts, or access by index: ${data}[0][0].
error ValueError: No columns to parse from file
cause CSV file is empty or has no data rows.
fix
Ensure the CSV file contains data and headers (for associative).
breaking Version 0.0.5 introduced DotDict support; associative returns DotDict objects instead of dicts. This changes how you access items: use ${dict}[key] or ${dict.key} for keys without spaces.
fix Update test cases to use DotDict syntax: ${dict}[key] or ${dict.key}.
gotcha The library does NOT support spaces in CSV headers when using DotDict syntax (e.g., ${dict}.First Name fails). Use standard bracket notation instead: ${dict}['First Name'].
fix Use ${dict}['header with spaces'] instead of ${dict}.header_with_spaces.
deprecated Old keyword 'read csv file to associative' returns dict; new keyword returns DotDict. The old behavior is deprecated and may be removed.
fix Use 'read csv file to associative' (returns DotDict) or 'read csv file to list' for lists.

Basic usage: import CSVLibrary and use read csv file to list keyword.

*** Settings ***
Library  CSVLibrary

*** Test Cases ***
Read CSV File To List
    ${data}=    read csv file to list    data.csv
    Log Many    @{data}