Might be a bit of a reach, but I'm working on a system to allow Race Control to send live updates through a google form. I wrote a console application to read off of the google sheets document that form generates. My question - how can I, or is it possible to, install the sheets/drive API into ATVO so that the references are all referenced?
using Google.Apis.Auth.OAuth2;
using Google.Apis.Sheets.v4;
using System;
using System.IO;
namespace SYMTVRaceControl
{
class Program
{
static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
static readonly string ApplicationName = "SYMTVRaceControl Comms";
static readonly string SpreadsheetId = "1i4JUeXF-IbC-jD_Qk5bi8EEclBAB8-FQJhA7lz6xsC0";
static readonly string sheet = "Control";
static SheetsService service;
static void Main(string[] args)
{
GoogleCredential credential;
using (var stream = new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream)
.CreateScoped(Scopes);
}
service = new SheetsService(new Google.Apis.Services.BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
ReadEntries();
Console.Read();
}
static void ReadEntries()
{
var range = $"{sheet}!A2:F20";
var request = service.Spreadsheets.Values.Get(SpreadsheetId, range);
var response = request.Execute();
var values = response.Values;
if(values != null && values.Count > 0)
{
foreach (var row in values)
{
Console.WriteLine("{0}: {1}, {2}, {3}, {4} {5}", row[0], row[1], row[2], row[3], row[4], row[5]);
}
}
else
{
Console.WriteLine("No data was found");
}
}
}
}