I am new to using Google Cloud Platform and its Developer Console. Here, I am working on a project wherein I have to automate data transfer from google sheets to SQL Server daily using Task Scheduler. Here, I came across an approach which requires me to share Google Sheet to a service account to read data from it in Python. This approach would require me to share each and every sheet in my company's drive account to a service account which add an step for a manual intervention.
Is there any method or approach by which I can skip the process of sharing sheets to service account and read sheets directly from my google drive or so?
I tried below script of reading shared Google Sheets to a service account which works fine but that's not what I require.
import gspread, pyodbc, pandas as pd
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('service_account.json', scope)
client = gspread.authorize(creds)
sheet = client.open('Sample').sheet1
data = sheet.get_all_values()
Need you to assist me in such a methodology though if it uses an API key instead of an oauth.