This loader reads files from Google Drive using folder or file ids. To use this loader, you need to pass in a list of file id's or folder id.
You can extract a folder_id directly from its drive URL.
For example, the folder_id of https://drive.google.com/drive/folders/1w7XryYu6mL9VLmfyqUkA4_fRnDbsCqV- is 1w7XryYu6mL9VLmfyqUkA4_fRnDbsCqV-.
You can extract a file_id directly from its sharable drive URL.
For example, the file_id of https://drive.google.com/file/d/1LEqD_zQiOizKrBKZYKJtER_h6i49wE-y/view?usp=sharing is 1LEqD_zQiOizKrBKZYKJtER_h6i49wE-y.
We need credentials.json and client_secrets.json files to use this reader.
- You need to get your
credentials.jsonfile by following the steps mentioned here - Create duplicate file of
credentials.jsonwith nameclient_secrets.jsonwhich will be used by pydrive for downloading files.
Finally, make sure you enable "Google Drive API" in the console of your Google App.
from llama_index import download_loader
GoogleDriveReader = download_loader("GoogleDriveReader")
loader = GoogleDriveReader()
#### Using folder id
documents = loader.load_data(folder_id="folderid")
#### Using file ids
documents = loader.load_data(file_ids=["fileid1", "fileid2"])This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent. See here for examples.