Class SheetsServiceProvider
Configuration for connecting to a Google Sheet. Includes the Authorization properties and general sheet properties such as default sheet styles etc.
Inherited Members
Namespace: UnityEditor.Localization.Plugins.Google
Syntax
[CreateAssetMenu(fileName = "Google Sheets Service", menuName = "Localization/Google Sheets Service")]
[HelpURL("https://developers.google.com/sheets/api/guides/authorizing#AboutAuthorization")]
public class SheetsServiceProvider : ScriptableObject, IGoogleSheetsService
Properties
ApiKey
The API Key to use when using APIKey authentication.
Declaration
public string ApiKey { get; }
Property Value
Type | Description |
---|---|
String |
ApplicationName
The name of the application that will be sent when connecting.
Declaration
public string ApplicationName { get; set; }
Property Value
Type | Description |
---|---|
String |
Authentication
The authorization methodology to use. See https://developers.google.com/sheets/api/guides/authorizing
Declaration
public AuthenticationType Authentication { get; }
Property Value
Type | Description |
---|---|
AuthenticationType |
ClientId
Client Id when using OAuth authentication.
See alsoDeclaration
public string ClientId { get; }
Property Value
Type | Description |
---|---|
String |
ClientSecret
Client secret when using OAuth authentication.
See alsoDeclaration
public string ClientSecret { get; }
Property Value
Type | Description |
---|---|
String |
DataStore
Used to make sure the access and refresh tokens persist. Uses a FileDataStore by default with "Library/Google/{name}" as the path.
Declaration
public IDataStore DataStore { get; set; }
Property Value
Type | Description |
---|---|
IDataStore |
NewSheetProperties
Properties to use when creating a new Google Spreadsheet sheet.
Declaration
public NewSheetProperties NewSheetProperties { get; set; }
Property Value
Type | Description |
---|---|
NewSheetProperties |
Service
The Google Sheet service that will be created using the Authorization API.
Declaration
public virtual SheetsService Service { get; }
Property Value
Type | Description |
---|---|
SheetsService |
Implements
Methods
AuthoizeOAuth()
Call to preauthorize when using OAuth authorization. This will cause a browser to open a Google authorization
page after which the token will be stored in
Declaration
public UserCredential AuthoizeOAuth()
Returns
Type | Description |
---|---|
UserCredential |
OnEnable()
Declaration
public void OnEnable()
SetApiKey(String)
Set the API Key. An API key can only be used for reading from a public Google Spreadsheet.
Declaration
public void SetApiKey(string apiKey)
Parameters
Type | Name | Description |
---|---|---|
String | apiKey |
SetOAuthCrendtials(String)
Enable OAuth 2.0 authentication and extract the ClientId and ClientSecret from the supplied json.
Declaration
public void SetOAuthCrendtials(string credentialsJson)
Parameters
Type | Name | Description |
---|---|---|
String | credentialsJson |
SetOAuthCrendtials(String, String)
Enable OAuth 2.0 authentication with the provided client Id and client secret.
Declaration
public void SetOAuthCrendtials(string clientId, string clientSecret)
Parameters
Type | Name | Description |
---|---|---|
String | clientId | |
String | clientSecret |