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:
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:
Screenshot by Lightshot
The API call successfully returns the data:
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.