Bugs with reading data from sheets when there's no data to return (empty sheets/range) (built-in spreadsheet component)

ReadSheet, ReadWithPartialFilter, ReadWithExactFilter methods - while trying to read an empty sheet it throws an error: “RetrieveSheet: Unknown Error: Attempt to invoke interface method ‘int java.util.List.size()’ on a null object”.
Someone forgot to check if there is any data.

ReadColumn, ReadRow, ReadRange just throw an error “No data found”.

ReadCell just returns empty result.

All methods should return empty data (lists) if there are no data as this is not an error. The way it works no does not allow for checking if we have an empty sheet or cells (ReadRange) or even to search a sheet for specific data (read with filters).

You are correct. I've filed an issue so we can track this.

1 Like

@ewpatton ReadCell returns empty string, I think that’s the expected result?

PS: A fix is here

I think it's correct that ReadCell should provide an empty text if there is nothing there. The only exception would be if they attempt to read a cell outside the bounds of the sheet, in which case that should raise an error.

I tried to read cell A1001 that resulted in an error, so this block is working fine.

See

Please test.

Wow, this was really quick.

It works perfectly. All methods now return empty lists without any errors and throw errors only if there’s an actual error (wrong sheet name, range, cell/column/row reference).

2 Likes

It feels so good after seeing your response :grinning_face: