Google Spreadsheets Data Model

Connection String Options

  1. Auto Cache
  2. Cache Connection
  3. Cache Driver
  4. Cache Location
  5. Cache Metadata
  6. Connect On Open
  7. Firewall Password
  8. Firewall Port
  9. Firewall Server
  10. Firewall Type
  11. Firewall User
  12. Header
  13. Initiate OAuth
  14. Location
  15. Logfile
  16. Max Log File Size
  17. OAuth Access Token
  18. OAuth Client Id
  19. OAuth Client Secret
  20. OAuth JWT Cert
  21. OAuth JWT Cert Password
  22. OAuth JWT Cert Subject
  23. OAuth JWT Cert Type
  24. OAuth JWT Issuer
  25. OAuth JWT Subject
  26. OAuth Refresh Token
  27. OAuth Settings Location
  28. Offline
  29. Other
  30. Proxy Auth Scheme
  31. Proxy Auto Detect
  32. Proxy Password
  33. Proxy Port
  34. Proxy Server
  35. Proxy SSL Type
  36. Proxy User
  37. Pseudo Columns
  38. Query Cache
  39. Readonly
  40. Row Scan Depth
  41. RTK
  42. Show Formula
  43. Spreadsheet
  44. SSL Server Cert
  45. Support Enhanced SQL
  46. Tables
  47. Timeout
  48. Type Detection Scheme
  49. Verbosity

Auto Cache

Data Type

bool

Default Value

false

Remarks

When AutoCache is set, the driver automatically caches the results of SELECT queries to a cache specified by the CacheLocation option. CacheLocation defines the path to a simple, file-based cache.

AutoCache is the simplest caching configuration available, however, like any caching scheme, using a cache is not without pitfalls such as reporting on stale data. The driver is designed to be fully functional without relying on caching.

The following sections outline how and when to use AutoCache. Understanding how AutoCache works and its limitations will help you choose an effective caching strategy. For more information on deploying other caching strategies, see Caching Data.

How AutoCaching Works

When you execute a SELECT statement with AutoCache set, the driver executes the query to the remote data and persists the results; rows and columns that already exist are overwritten. That is, SELECT statements are used to create and refresh the cache, not to query it.

Non-queries (such as UPDATE/INSERT/DELETE statements) are executed to the remote data as well; these statements will not modify the data in the cache at all, regardless of the value set for AutoCache.

To work with the local data, append #CACHE to the table name. For example:

SELECT * FROM [Worksheet1#CACHE]
Limitations of AutoCache

In the following scenarios, consider the alternatives listed below:

  • When you need to work with the cache transparently: Because AutoCache requires a special syntax to utilize the cache, it is not suitable for use with BI, analytics, and reporting. Many of these tools generate SQL statements for you; these generated statements will still be executed to Google Spreadsheets instead of the cache.

    In these situations, one solution is to use the Offline property. When this is set, all queries are executed locally. See Caching: Best Practices for examples.

    One downside of this approach is that it requires a separate connection. As an alternative, consider using the CData Sync tool to maintain a local database that is kept fresh with scheduled updates.

  • When you need more control over cached data: The AutoCache feature does not have the ability to remove rows from the cache that were deleted from the remote data. It also does not support dropping a table from the cache or more advanced cache maintenance such as changing the cached table schemas.

    In this scenario, consider CACHE Statements. CACHE statements can remove cached rows that no longer exist in Google Spreadsheets.

    See Caching Explicitly for more information on how to use CACHE statements.

  • When you need to work with an RDBMS: AutoCache can only be used with the default database, JavaDB or SQLite. Many enterprises will need to use an RDBMS to support more concurrent writes or integrate with existing infrastructure. You can specify a database driver with CacheConnection and CacheDriver.



Cache Connection

Data Type

string

Default Value

""

Remarks

The cache database is determined based on the CacheDriver and CacheConnection properties. The CacheConnection defines the connection properties necessary to connect to the cache database.

Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost:7437;user=sa;password=123456;databaseName=Cache'



Cache Driver

Data Type

string

Default Value

""

Remarks

You can cache to any database that you have a JDBC driver for. The driver has been tested with SQL Server, Derby and Java DB, MySQL, Oracle, and SQLite.

The cache database is determined based on CacheDriver and the CacheConnection properties. The CacheDriver is the name of the JDBC driver class that you would like to use to cache data. The example below caches to SQL Server:

Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost:7437;user=sa;password=123456;databaseName=Cache'
Note that the driver JAR must be specified on the classpath.



Cache Location

Data Type

string

Default Value

""

Remarks

If AutoCache is set but the cache location is not specified, CacheLocation defaults to the cache folder on the directory specified by the Location setting.

The CacheLocation is a simple, file-based cache. See the CacheConnection and CacheDriver properties to cache to other databases.



Cache Metadata

Data Type

bool

Default Value

false

Remarks

The cache.db file will be created in the location specified by the CacheConnection or if that is not set, the CacheLocation.



Connect On Open

Data Type

bool

Default Value

true

Remarks

When set to 'true', a connection will be made to Google Spreadsheets when the connection is opened. This property enables the 'Test Connection' feature available in various database tools.

This feature acts as a NOOP command as it is used to verify a connection can be made to Google Spreadsheets and nothing from this initial connection is maintained.

Setting this property to 'false' may provide performance improvements (depending upon the number of times a connection is opened).



Firewall Password

Data Type

string

Default Value

""

Remarks

If FirewallServer is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall.



Firewall Port

Data Type

string

Default Value

""

Remarks

Note that the driver sets the FirewallPort to the default port associated with the specified FirewallType. See the description of the FirewallType option for details.



Firewall Server

Data Type

string

Default Value

""

Remarks

If this property is set to a domain name, a DNS request is initiated and the name is translated to the corresponding IP address.



Firewall Type

Data Type

string

Default Value

"NONE"

Remarks

The applicable values are:

Firewall Type Default FirewallPort
TUNNEL 80
SOCKS4 1080
SOCKS5 1080



Firewall User

Data Type

string

Default Value

""

Remarks

If the FirewallServer is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate against the firewall.



Header

Data Type

bool

Default Value

true

Remarks

If true, the first row will be used as a column header. Otherwise, the pseudo column names (A, B, C, etc.) will be used.



Initiate OAuth

Data Type

string

Default Value

"OFF"

Remarks

The following options are available:

  1. OFF: Indicates that the OAuth flow will be handled entirely by the user. An OAuthAccessToken will be required to authenticate.
  2. GETANDREFRESH: Indicates that the entire OAuth Flow will be handled by the driver. If no token currently exists, it will be obtained by prompting the user via the browser. If a token exists, it will be refreshed when applicable.
  3. REFRESH: Indicates that the driver will only handle refreshing the OAuthAccessToken. The user will never be prompted by the driver to authenticate via the browser. The user must handle obtaining the OAuthAccessToken and OAuthRefreshToken initially.



Location

Data Type

string

Default Value

""

Remarks

The path to a directory which contains the schema files for the driver (.rsd files for tables and views, .rsb files for stored procedures). The Location property is only needed if you would like to customize definitions (e.g., change a column name, ignore a column, etc.) or extend the data model with new tables, views, or stored procedures.

The schema files used in your application must be deployed with other assemblies. You must also ensure that Location points to the folder that contains the schema files. The folder location can be a relative path from the location of the executable.



Logfile

Data Type

string

Default Value

""

Remarks

For more control over what is written to the log file, take a look at Verbosity.



Max Log File Size

Data Type

string

Default Value

""

Remarks

A string specifying the maximum size in bytes for a log file (ex: 10MB). When the limit is hit, a new log is created in the same folder with the date and time appended to the end. There is no limit by default. Values lower than 100kB will use 100kB as the value instead.



OAuth Access Token

Data Type

string

Default Value

""

Remarks

The OAuthAccessToken property is used to connect using OAuth. The OAuthAccessToken is retrieved from the OAuth server as part of the authentication process. It has a server-dependent timeout and can be reused between requests.

The access token is used in place of your username and password. The access token protects your credentials by keeping them on the server.



OAuth Client Id

Data Type

string

Default Value

""

Remarks

OAuth requires you to register your application. As part of the registration, you will receive a client Id, sometimes also called a consumer key, and a client secret. You must specify both the OAuthClientId and OAuthClientSecret to connect to an OAuth server.



OAuth Client Secret

Data Type

string

Default Value

""

Remarks

OAuth requires you to register your application. As part of the registration you will receive a client Id and a client secret, sometimes also called a consumer secret. You must specify both the OAuthClientId and OAuthClientSecret to connect to an OAuth server.



OAuth JWT Cert

Data Type

string

Default Value

""

Remarks

The name of the certificate store for the client certificate.

The OAuthJWTCertType field specifies the type of the certificate store specified by OAuthJWTCert. If the store is password protected, specify the password in OAuthJWTCertPassword.

OAuthJWTCert is used in conjunction with the OAuthJWTCertSubject field in order to specify client certificates. If OAuthJWTCert has a value, and OAuthJWTCertSubject is set, a search for a certificate is initiated. Please refer to the OAuthJWTCertSubject field for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot certificates.
SPCSoftware publisher certificates.

In Java, the certificate store normally is a file containing certificates and optional private keys.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).



OAuth JWT Cert Password

Data Type

string

Default Value

""

Remarks

If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.



OAuth JWT Cert Subject

Data Type

string

Default Value

"*"

Remarks

When loading a certificate the subject is used to locate the certificate in the store.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks the first certificate in the certificate store.

The certificate subject is a comma separated list of distinguished name fields and values. For instance "CN=www.server.com, OU=test, C=US, E=support@cdata.com". Common fields and their meanings are displayed below.

FieldMeaning
CNCommon Name. This is commonly a host name like www.server.com.
OOrganization
OUOrganizational Unit
LLocality
SState
CCountry
EEmail Address

If a field value contains a comma it must be quoted.



OAuth JWT Cert Type

Data Type

string

Default Value

""

Remarks

This property can take one of the following values:

USER - defaultFor Windows, this specifies that the certificate store is a certificate store owned by the current user. Note: This store type is not available in Java.
MACHINEFor Windows, this specifies that the certificate store is a machine store. Note: this store type is not available in Java.
PFXFILEThe certificate store is the name of a PFX (PKCS12) file containing certificates.
PFXBLOBThe certificate store is a string (base-64-encoded) representing a certificate store in PFX (PKCS12) format.
JKSFILEThe certificate store is the name of a Java key store (JKS) file containing certificates. Note: this store type is only available in Java.
JKSBLOBThe certificate store is a string (base-64-encoded) representing a certificate store in Java key store (JKS) format. Note: this store type is only available in Java.
PEMKEY_FILEThe certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate.
PEMKEY_BLOBThe certificate store is a string (base64-encoded) that contains a private key and an optional certificate.
PUBLIC_KEY_FILEThe certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate.
PUBLIC_KEY_BLOBThe certificate store is a string (base-64-encoded) that contains a PEM- or DER-encoded public key certificate.
SSHPUBLIC_KEY_FILEThe certificate store is the name of a file that contains an SSH-style public key.
SSHPUBLIC_KEY_BLOBThe certificate store is a string (base-64-encoded) that contains an SSH-style public key.
P7BFILEThe certificate store is the name of a PKCS7 file containing certificates.
PPKFILEThe certificate store is the name of a file that contains a PPK (PuTTY Private Key).
XMLFILEThe certificate store is the name of a file that contains a certificate in XML format.
XMLBLOBThe certificate store is a string that contains a certificate in XML format.



OAuth JWT Issuer

Data Type

string

Default Value

""

Remarks

The issuer of the Java Web Token. This is typically either the Client ID or Email Address of the OAuth Application.



OAuth JWT Subject

Data Type

string

Default Value

""

Remarks

The user subject for which the application is requesting delegated access. Typically, the user account name or email address.



OAuth Refresh Token

Data Type

string

Default Value

""

Remarks

The OAuthRefreshToken property is used to refresh the OAuthAccessToken when using OAuth authentication.



OAuth Settings Location

Data Type

string

Default Value

"%APPDATA%\\CData\\GoogleSheets Data Provider\\OAuthSettings.txt"

Remarks

When InitiateOAuth is set to GETANDREFRESH or REFRESH, the driver saves OAuth values to a settings file to avoid requiring the user to manually enter OAuth connection properties. The default OAuthSettingsLocation is a settings file located in the %AppData%\CData folder.



Offline

Data Type

bool

Default Value

false

Remarks

When Offline is set to TRUE, all queries execute against the cache as opposed to the live data source. In this mode, certain queries like INSERT, UPDATE, DELETE, and CACHE are not allowed.



Other

Data Type

string

Default Value

""

Remarks

The Other property is a semicolon-separated list of name-value pairs used in connection parameters specific to a data source.

Caching Configuration

CachePartial=TrueCaches only a subset of columns, which you can specify in your query.
QueryPassthrough=TruePasses the specified query to the cache database instead of using the SQL parser of the driver.

Integration and Formatting

SupportAccessLinkedModeIn Access' linked mode, it is generally a good idea to always use a cache as most data sources do not support multiple Id queries. However if you want to use the driver in Access but not in linked mode, this property must be set to False to avoid using a cache of a SELECT * query for the given table.
ConvertDateTimesToGMTWhether to convert date-time values to GMT, instead of the local time of the machine.
RecordToFile=filenameRecords the underlying socket data transfer to the specified file.
ClientCultureThis property can be used to specify the format of data (e.g., currency values) that is accepted by the client application. This property can be used when the client application does not support the machine's culture settings. For example, Microsoft Access requires 'en-US'.
CultureThis setting can be used to specify culture settings that determine how the driver interprets certain data types that are passed into the driver. For example, setting Culture='de-DE' will output German formats even on an American machine.



Proxy Auth Scheme

Data Type

string

Default Value

"BASIC"

Remarks

This value may be BASIC, DIGEST, NONE, NTLM, NEGOTIATE or PROPRIETARY.



Proxy Auto Detect

Data Type

bool

Default Value

true

Remarks

This indicates whether to use the default system proxy settings or not. Set ProxyAutoDetect to FALSE to use custom proxy settings. This takes precedence over other proxy settings.



Proxy Password

Data Type

string

Default Value

""

Remarks

If the ProxyServer is specified, the ProxyUser and ProxyPassword properties are used to connect and authenticate against the firewall.



Proxy Port

Data Type

string

Default Value

"80"

Remarks

See the description of the ProxyServer field for details.



Proxy Server

Data Type

string

Default Value

""

Remarks

If this property is set to a domain name, a DNS request is initiated and the name is translated to the corresponding address.



Proxy SSL Type

Data Type

string

Default Value

"AUTO"

Remarks

This value may be AUTO, ALWAYS, NEVER, or TUNNEL.



Proxy User

Data Type

string

Default Value

""

Remarks

If a ProxyServer is specified, the ProxyUser and ProxyPassword options are used to connect and authenticate against the firewall.



Pseudo Columns

Data Type

string

Default Value

""

Remarks

This setting is particularly helpful in Entity Framework, which does not allow you to set a value for a pseudo column unless it is a table column. The value of this connection setting is of the format "Table1=Column1, Table1=Column2, Table2=Column3". You can use the "*" character to include all tables and all columns; i.e., "*=*".



Query Cache

Data Type

string

Default Value

""

Remarks

The QueryCache allows you to cache the results of a query in-memory and use them until the cache expires. Setting the QueryCache can improve performance if the same or similar (see below) queries are executed often. The in-memory query cache is shared across connections, so it can help with performance even if more than one connection is being used.

The cache manager for QueryCache will not only use the results in the cache for exactly the same query, but also for queries that represent a subset of data in the cached query. For example, in the following queries, the cache created while executing Query A will be used to obtain the results for both Query B and Query C.

SELECT * from Account; // Query A
SELECT * from Account WHERE Name LIKE '%John'; // Query B
SELECT Id, Name from from Account LIMIT 10; // Query C

Setting the QueryCache to zero disables in-memory caching.



Readonly

Data Type

bool

Default Value

false

Remarks

If this property is set to true, the driver will allow only SELECT queries. INSERT, UPDATE, DELETE, and stored procedure queries will cause an error to be thrown.



Row Scan Depth

Data Type

string

Default Value

"15"

Remarks

Determines the number of rows used to determine the column data types.

Setting a high value may decrease performance. Setting a low value may prevent the data type from being determined properly, especially when there is null data.



RTK

Data Type

string

Default Value

""

Remarks

The RTK property may be used to license a build. Please see the included licensing file to see how to set this property. The runtime key is only available if you purchased an OEM license.



Show Formula

Data Type

bool

Default Value

false

Remarks

Formulas require special treatment in Google Spreadsheets documents.

Selecting Formulas

When the Header is set to false, you can use ShowFormula to control whether the formula or the formula's result is returned.

Due to limitations of the Google Spreadsheets API, any SELECT executed when the connection string property Header is set to true will return only the value of the formula.

Updating Formulas

The driver allows you to update cells using formulas. When the Header property is set to false, any value entered beginning with "=" will be treated as a formula. For example, the following command will insert a formula into row 6 column B that will be the result of the sum of cells B1 to B5:

UPDATE Sheet1 SET A='Bill', B='=SUM(B1:B5)' WHERE Id='6'



Spreadsheet

Data Type

string

Default Value

""

Remarks

A list of all spreadsheets is available from the Spreadsheets view; this includes the name and feed link.

Note: If you specify a name and multiple spreadsheets have that name, only the first one created will be returned. To avoid this issue, use the feed link instead.



SSL Server Cert

Data Type

string

Default Value

""

Remarks

If using a TLS/SSL connection, this property can be used to specify the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine will be rejected. This can take the form of a full PEM certificate, the path to a file containing the certificate, the public key, the MD5 thumbprint, or the SHA1 thumbprint. If not specified, any trusted certificate will be accepted. Use '*' to signify to accept all certificates (not recommended for security concerns).



Support Enhanced SQL

Data Type

bool

Default Value

true

Remarks

Use QueryCache to cache in memory for a given time in seconds or to disable in-memory caching.



Tables

Data Type

string

Default Value

""

Remarks

Listing the tables from some databases can be expensive. Providing a list of tables in the connection string improves the performance of the driver.



Timeout

Data Type

string

Default Value

"60"

Remarks

If the Timeout property is set to 0, operations do not time out: They run until they complete successfully or encounter an error condition.

If Timeout expires and the operation is not yet complete, the driver throws an exception.



Type Detection Scheme

Data Type

string

Default Value

"RowScan"

Remarks

NoneSetting TypeDetectionScheme to None will return all columns as string type. Note: Even when set to None, the column names will still be scanned when Header=True.
RowScanSetting TypeDetectionScheme to RowScan will scan rows to heuristically determine the data type. The RowScanDepth determines the number of rows to be scanned.



Verbosity

Data Type

string

Default Value

"1"

Remarks

The verbosity level determines the amount of detail that the driver reports to the Logfile. Verbosity levels from 1 to 5 are supported. These are described below:

1Setting Verbosity to 1 will log the query, the number of rows returned by it, the start of execution and the time taken, and any errors.
2Setting Verbosity to 2 will log everything included in Verbosity 1, cache queries, and HTTP headers.
3Setting Verbosity to 3 will additionally log the body of the HTTP requests.
4Setting Verbosity to 4 will additionally log transport-level communication with the data source. This includes SSL negotiation.
5Setting Verbosity to 5 will additionally log communication with the data source and additional details that may be helpful in troubleshooting problems. This includes interface commands.

The Verbosity should not be set to greater than 1 for normal operation. Substantial amounts of data can be logged at higher verbosities, which can delay execution times.





Views

  1. Spreadsheets

Spreadsheets

Returns a list of a user's spreadsheets and their relevant information.

Columns

Name Type Description
Id [KEY] String The assigned Id of the spreadsheet.
Name String The name of this spreadsheet.
FeedLink String The feed link of the spreadsheet.
AuthorName String The name of the author of this spreadsheet.
AuthorEmail String The email of the author of this spreadsheet.
Updated String The last updated date and time of this spreadsheet.
Weblink String Link to the spreadsheet.