Read column with one row

excel

#1

Hi, I have to read a column in xlsm starting from “A1”, but this column could have only one row. In this case I have an exception:

    `testreadcolumn has thrown an exception`

    Message: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).

    Source: Write line

    Exception Type: NullReferenceException

How can I do?


#2

Use a try catch activity, or another approach would be using read cell and check if its empty and go from there


#3

Hi,
How your reading xlsm file.Even if there is no item in the cell A it returns empty.You don’t get null exception.
Error occurred at write line.
Could you please attach your workflow.


#4

Hi all,

I notized this behavior as well. Please find attached my workflow. If you use an excel file with one row you can reproduce the error mentioned above. If you use two rows it works fine.

Since my excel file could have any amount of filled rows as well as one filled row wirth many columns, read cell would be only a quick solution.

Some hints how a can still use read column for this?

Main.xaml (6.4 KB)


#5

I think i’ve actually done something similar. Had to make sure that the TypeArgument in the For Each activity was Object.
asdf3


#6

I’m afraid that this does not solve my problem. With read column I get an IEnumerable, not a datatable.

Any other hints?
@ddpadil