Skip to content

Commit

Permalink
Open the google sheet in the browser after syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
e13h committed Apr 5, 2022
1 parent 41ac829 commit 255a040
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gsheets_plaid/sync.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import webbrowser
from datetime import datetime, timedelta
from importlib.resources import files

Expand Down Expand Up @@ -292,6 +293,13 @@ def get_access_tokens() -> list[dict]:
return tokens


def get_spreadsheet_url() -> str:
"""Get the URL of the Google Sheet.
"""
response = gsheets_service.spreadsheets().get(spreadsheetId=get_spreadsheet_id()).execute()
return response.get('spreadsheetUrl')


def sync_transactions(plaid_env: str = None, num_days: int = 30):
"""Put transaction data into Google Sheet.
"""
Expand All @@ -307,6 +315,7 @@ def sync_transactions(plaid_env: str = None, num_days: int = 30):
continue
fill_gsheet(result)
apply_gsheet_formatting(result)
webbrowser.open(get_spreadsheet_url(), new=1, autoraise=True)


if __name__ == '__main__':
Expand Down

1 comment on commit 255a040

@e13h
Copy link
Owner Author

@e13h e13h commented on 255a040 Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves #1

Please sign in to comment.