Python 将Google Sheets数据导入红移

Python 将Google Sheets数据导入红移,python,google-sheets,amazon-redshift,google-api-python-client,google-python-api,Python,Google Sheets,Amazon Redshift,Google Api Python Client,Google Python Api,我正试图将谷歌表格中的数据输入我们的红移数据库。我能够按照此链接中的说明进行操作: 有没有可能让它从文件夹中最近添加的谷歌工作表中提取数据(而不是仅仅指定一张工作表)并写入红移表 以下是用于将google sheets数据读入Python的内容: import gspread from oauth2client.service_account import ServiceAccountCredentials # use creds to create a client to interact

我正试图将谷歌表格中的数据输入我们的红移数据库。我能够按照此链接中的说明进行操作:

有没有可能让它从文件夹中最近添加的谷歌工作表中提取数据(而不是仅仅指定一张工作表)并写入红移表

以下是用于将google sheets数据读入Python的内容:

import gspread
from oauth2client.service_account import ServiceAccountCredentials


# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)

# Find a workbook by name and open the first sheet
# Make sure you use the right name here.
sheet = client.open("Copy of Legislators 2017").sheet1

# Extract and print all of the values
list_of_hashes = sheet.get_all_records()
print(list_of_hashes)
您可以使用在给定时间范围内添加的特定类型的to。将列出此类查询的所有搜索参数和语法

# Build the Drive service
...

# Query for recent files, with stipulation that their mimetype contains "spreadsheet"
query = "mimeType contains 'spreadsheet' and modifiedTime > '"
query += someDateAsUTC_inRFC_3339_String + "'"

# Execute the query
request = drive.files.list(q=query, .... )
resp = request.execute()
nextPage = resp['nextPageToken']
if resp['files']:
    # Call method to consume files
while nextPage:
    request = drive.files.list_next(request, resp)
    if request:
        resp = request.execute()
        nextPage = resp['nextPageToken']
        if resp['files']:
            # Call method to consume files
    else
        break
# Done