I want to get all sheet names of the connected google account in my application. For this, I created oauth2 and got the client ID and enabled Google Drive API for accessing the Sheets in Google Cloud Console. On Clicking the button in my app, I opened the Google SignIn Panel for selecting Account. On selecting the Account, I get the profile Details. Now I want to get all the sheet names of the account. I searched a lot. But can't find any solutions. Please Help me with some solutions. I need to list out the sheet names of the connected google account
Here's the Code for Authorization:
const HomePage = () => {
const googleClientID = 'xxxsxxxx-xxxxxxdfdfdxxxxxx2.apps.googleusercontent.com'
const googleSuccess = async (res) => {
console.log("googleSuccess")
console.log(res)
}
const googleError = (error) => {
console.log(error);
alert('Google Sign In was unsuccessful. Try again later');
}
useEffect(() => {
function start() {
gapi.client.init({
clientId: googleClientID,
scope: ['https://www.googleapis.com/auth/drive', 'profile'],
});
}
gapi.load('client:auth2', start);
}, []);
return (
<GoogleLogin
clientId={googleClientID}
render={(renderProps) => (
<Button style={{ backgroundColor: "blue", width: "400px" }}
fullWidth onClick={renderProps.onClick}
disabled={renderProps.disabled} startIcon={<Icon />} variant="contained">
Add Subscription by Google Sign In
</Button>
)}
onSuccess={googleSuccess}
onFailure={googleError}
cookiePolicy="single_host_origin"
/>
)
}
export default HomePage;