GSpread.NET - Google Spreadsheets .NET APIGSpread.NET

Google account settings

By default, GSpread.NET uses its sample identifiers. But we recommend to change it into your own. In order to do this, please, make the following steps: Go to your Google Drive http://drive.google.com and create a new script (Select "NEW > More > Google Apps Script"):

GSpread.NET

If there is no such menu option, you can select "Connect more apps", search for "apps script" in the opened dialog and then connect to Google Apps Script.

GSpread.NET

Copy the script code from "<Project Folder>/src/GSpreadCOM/Resources/GoogleAppsScript.gs" to the Code.gs you’ve just created. Also, you can find the script here: http://scand.com/download/products/GSpread.NET/GoogleAppsScript.gs

GSpread.NET

Save script project as e.g. "GSpreadCOM_Script":

GSpread.NET

Than, open menu "Publish > Deploy as API executable…"

GSpread.NET

Set any version, e.g. 1 and press "Deploy":

GSpread.NET

GSpread.NET

Now we need to configure GSpreadCOM_Script project.
Go to Google API Console https://console.developers.google.com and select a project:

GSpread.NET

Go to "Overview > Google APIs", search and enable Google Drive API:

GSpread.NET

GSpread.NET

and Google Apps Script Execution API:

GSpread.NET

GSpread.NET

Now we need to create credentials:

GSpread.NET

Select "OAuth client ID":

GSpread.NET

Application type - "Other" and press "Create":

GSpread.NET

GSpread.NET

Copy "client ID" and "secret ID" into GSpreadCOM.config

<?xml version="1.0" encoding="utf-8"?>
<config>
 <user name="any random name"/>
 <client id="52444250292-02d5nuj5osdf268h605djiukijd5i4m5.apps.googleusercontent.com"
  secret="q2IOcXHThZ3LPc5nfFCcA_r"/>
 <script id="Mvi58b-XTLQOC7mbLFOvENmbpWLEH-geZ"/>
</config>

You can use this values as the second parameter of Application.MailLogon method in "client_id|client_secret" format:

app.MailLogon("any random name", "52444250292-
02d5nuj5osdf268h605djiukijd5i4m5.apps.googleusercontent.com|q2IOcXH-
ThZ3LPc5nfFCcA_r", "Mx1qw1DNjz3vrzoYbLfc5H0sBksCqgDyL");

That's all!