How to import Google Sheets data in a bubble app?

I’m working on a feature that allows users to import data from their Google Sheets into a Bubble app after connecting via OAuth2, so they can perform operations on that data. For example, an advertiser running campaigns on digital platforms might store campaign data in Google Drive and would want to import this data into the Bubble app to analyze campaign KPIs.

So far, I’ve set up the OAuth2 API connection, and the user can log into their Google account and connect to Google Drive. However, the process is still quite manual. After logging in, I currently have to extract an authorization code from the URL after the page refreshes and then use it to manually generate an access token:
:backhand_index_pointing_right: Screenshot by Lightshot

Once I have the access token, I can use it to make a Google Sheets API call to retrieve data from a specific sheet:
:backhand_index_pointing_right: Screenshot by Lightshot

The API call successfully returns the data:
:backhand_index_pointing_right: Screenshot by Lightshot

What I’m struggling with is how to automate this process. Ideally, the flow should be:

The user accesses the Bubble app → Connects their Google account → Selects a Google Sheet → Imports the data → Performs operations on it within the app.

Do that so you have the value in a workflow action. You do not need to copy paste from the URL in the Browser, as Bubble has the operator for dynamic expressions of ‘get data from URL’ and when you properly write the name of the parameter, it can extract the value for you.

Use a conditional workflow trigger for when the parameter value is not empty, to extract it, and then use go to page action, to the same page and check box to remove from history so the URL history is wiped clean and user can not inadvertenly use browser back button to get the parameter back into the url setting off the entire series of actions again.

Run the API call as an action to get the access token and save to the DB for the user…AND the REFRESH TOKEN

Setup system in backend to automatically retrieve a new access token when the access token expires.