public static void CredentialSheetServiceByToken()
    {
        if (DriveService == null)
        {
            UserCredential credential;
            using (var stream =
                       new FileStream(credentialPath, FileMode.Open, FileAccess.Read))
            {
                string credPath = "token.json";
                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    new string[] { SheetsService.Scope.Spreadsheets },
                    "user",
                    CancellationToken.None,
                    new FileDataStore(credPath, true)).Result;
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Drive API service.
            var service = new SheetsService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = ApplicationName,
            });
            SheetService = service;
            SheetManager.Init(service);
        }
    }
        public LiveSpreadsheetsDb(Google.Apis.Sheets.v4.SheetsService apisSheetsService, Google.Apis.Drive.v3.DriveService apisDriveService, string spreadsheetId)
        {
            // Assign DBIndex spreadsheet id.
            this.SpreadsheetsDbSpreadsheetId = spreadsheetId;

            // Assign provided google apis sheets service
            this._apisSheetsService = apisSheetsService;

            // Assign provided google apis sheets service
            this._apisDriveService = apisDriveService;

            // Obtains database spreadsheets index.
            this.ObtainDBSpreadsheetsIndex();
        }