@@ -0,0 +1,1931 @@
+package data;%0A%0Aimport com.google.api.client.auth.oauth2.Credential;%0Aimport com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;%0Aimport com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;%0Aimport com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;%0Aimport com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;%0Aimport com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;%0Aimport com.google.api.client.json.jackson2.JacksonFactory;%0Aimport com.google.api.client.util.store.MemoryDataStoreFactory;%0Aimport com.google.api.services.sheets.v4.SheetsScopes;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.security.GeneralSecurityException;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0A/** %0A * A class to create and send a Credential object that allows for Sheets API interaction %0A */%0Apublic class SheetsAuthUtil %7B%0A    public static Credential authorize() throws IOException, GeneralSecurityException %7B%0A         %0A        // Build GoogleClientSecrets from JSON file.%0A        InputStream in = GoogleAuthorizeUtil.class.getResourceAsStream(%22/google-sheets-api.json%22);%0A        GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JacksonFactory.getDefaultInstance(), new InputStreamReader(in));%0A%0A        List%3CString%3E scopes = Arrays.asList(SheetsScopes.SPREADSHEETS);%0A %0A        // Build Credential object.%0A        GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(%0A            GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), %0A            clientSecrets, scopes).setDataStoreFactory(new MemoryDataStoreFactory()).%0A            setAccessType(%22offline%22).build();%0A        Credential credential = new AuthorizationCodeInstalledApp(%0A            flow, new LocalServerReceiver()).authorize(%22user%22);%0A%0A        return credential;%0A    %7D%0A%7D%0A%0A

create SheetsAuthUtil class to create credentials for Sheets API interaction