Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue GoogleSheetExtractor with empty sheet. #639

Closed
scyzoryck opened this issue Oct 24, 2023 · 1 comment · Fixed by #641
Closed

Issue GoogleSheetExtractor with empty sheet. #639

scyzoryck opened this issue Oct 24, 2023 · 1 comment · Fixed by #641
Labels
bug Something isn't working

Comments

@scyzoryck
Copy link
Contributor

Hi!

We found a weird edge case when using the GoogleSheetExtractor - when trying to load data from completely empty sheet the return of google response is null.

# vendor/flow-php/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php:47
        /** @var Sheets\ValueRange $response */
        $response = $this->service->spreadsheets_values->get($this->spreadsheetId, $cellsRange->toString(), $this->options);
        /** @var array[] $values */
        $values = $response->getValues();

In reality it should be

# vendor/flow-php/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php:47
        /** @var Sheets\ValueRange $response */
        $response = $this->service->spreadsheets_values->get($this->spreadsheetId, $cellsRange->toString(), $this->options);
        /** @var null|array[] $values */
        $values = $response->getValues();

I feel like the issue is on the Google repository side, but may it would be worth to handle this edgecase in the package as well? I can provide a fix if needed.

Best, Marcin.

@norberttech
Copy link
Member

Yeah, that's a weird behavior.
A fix that would convert null into an empty array here would be very welcome unless you had a different idea of how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants