From d248481f130b2f6dcf0db80348f58a01ac69b18f Mon Sep 17 00:00:00 2001 From: IanRogers-101Ways <140076427+IanRogers-101Ways@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:05:02 +0100 Subject: [PATCH] skip over empty google spreadsheets (#8974) - Description: Allow GoogleDriveLoader to handle empty spreadsheets - Issue: Currently GoogleDriveLoader will crash if it tries to load a spreadsheet with an empty sheet - Dependencies: n/a - Tag maintainer: @rlancemartin, @eyurtsev --- libs/langchain/langchain/document_loaders/googledrive.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/langchain/langchain/document_loaders/googledrive.py b/libs/langchain/langchain/document_loaders/googledrive.py index 4538b469d02..9a0290a35ef 100644 --- a/libs/langchain/langchain/document_loaders/googledrive.py +++ b/libs/langchain/langchain/document_loaders/googledrive.py @@ -169,6 +169,8 @@ class GoogleDriveLoader(BaseLoader, BaseModel): .execute() ) values = result.get("values", []) + if not values: + continue # empty sheet header = values[0] for i, row in enumerate(values[1:], start=1):