robocorp / rpaframework

Collection of open-source libraries and tools for Robotic Process Automation (RPA), designed to be used with both Robot Framework and Python
https://www.rpaframework.org/
Apache License 2.0
1.17k stars 225 forks source link

`RPA.Tables`: Not getting the first column values from csv #1156

Closed BuilesYeison closed 8 months ago

BuilesYeison commented 9 months ago

Hi!

I am trying to get csv data using read_table_from_csv method from RPA.Tables, but, im getting the first column values as None. I checkout the column name and its not wrong, also i have added header parameter into the method and also i have changed the delimiters from ';' to ','.

Note: i am getting succesfully the other column values.

Code:

from RPA.Tables import Tables
tables = Tables()

CONFIG_PATH = "output/config.csv"
CONFIG_STATUS_KEY ="status"
CONFIG_TENANT_KEY = "tenant_name"
CONFIG_PATH_KEY = "path"

config_data = tables.read_table_from_csv(
            CONFIG_PATH, columns=[CONFIG_TENANT_KEY,CONFIG_STATUS_KEY,CONFIG_PATH_KEY], header=True
)

This is my config.csv file:

tenant_name,status,path
tenant1,active,C:\Users\{0}\Desktop\dev\PruebaConceptoRPA
tenant2,inactive,C:\Users\{0}\Desktop\dev\PruebaConceptoRPA

This is my conda.yaml file:

dependencies:
  - python=3.10.12                # https://pyreadiness.org/3.10
  - pip=23.2.1                    # https://pip.pypa.io/en/stable/news
  - robocorp-truststore=0.8.0     # https://pypi.org/project/robocorp-truststore/
  - pip:
    - rpaframework==28.0.0        # https://rpaframework.org/releasenotes.html
    - robocorp==1.4.0             # https://pypi.org/project/robocorp
    - robocorp-browser==2.2.1     # https://pypi.org/project/robocorp-browser

When i debug and explore the value, i see this: image

I think this is a bug, thank you for your time!

raivolink commented 9 months ago

Unable to replicate using provided conda , data and code. The result correctly shows columns with names(1. on image) with 2 rows(2. on image): image

BuilesYeison commented 8 months ago

I still cannot get the values, the only way to get correctly all column values in my case is adding an empty column in first place in csv file. Could be a problem with regional configuration? or in the project creation?

raivolink commented 8 months ago

It's difficult to comment on your regional settings because I don't have any information about those. If you use Robocorp tooling there should be no difference in project creation. The cause could be that the input csv is problematic, but it should work if it's the same as attached.

BuilesYeison commented 8 months ago

I think the problema is because i am downloading the csv document from an azure blob storage, so maybe the file being corrupted somehow, im not sure about it but im gonna close the issue.

smypmsa commented 8 months ago

Hey, by the way, I encountered the same issue. The problem was in the column names. Overriding column names doesn't work. At least for cases when we initialize a table from a csv file.