Open hemantaggarwal opened 4 years ago
I have Installed package 'gsheetsdb' (version=0.1.12) and other dependencies from the requirement.txt file. Then, I have run the following code in PyCharm:
from sqlalchemy import *
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import *
# Connection and authentication
service_account_file = "service_account_file.json" # your service account credential file
engine = create_engine('gsheets://', service_account_file=service_account_file, subject='your_business_domain@xx.com')
inspector = inspect(engine)
url = "google_spread_sheet_url"
# Processing
table = Table(
url,
MetaData(bind=engine),
autoload=True)
query = select([func.count(table.columns.cnt)], from_obj=table)
print(query.scalar())
Note: This works for me. You can try using a python script.
Thanks @JagritiG for the comment. I have started using a different approach but this will be helpful in future.
I installed gsheetsdb package and tried to use it in superset and in python script but I am getting connection failed error. What should be the full uri for gsheets?
Kindly help in this issue.