Possibility to connect a sheet and grab information in it.
Get/Find/Append/Update Data
Add/Duplicate Sheet
Copy/paste
etc.
This is something that I have worked on off and on. It’s a lot easier said than done when it comes to posting to Google Sheets. However, if you would like to read from Google Sheets this code I’ve had floating around the SB and Extension Discords and can get you started if you want to read from them in SB.
using System;
using System.IO;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
using Streamer.bot.Common.Events;
public class CPHInline
{
public class Sheets
{
public string range { get; set; }
public string majorDimension { get; set; }
public List<List<string>> values { get; set; }
}
public bool Execute()
{
var apikey = CPH.GetGlobalVar<string>("googleApiKey", true);
var user = args["user"].ToString();
var cells = args["cells"].ToString();
var sheetid = args["sheetId"].ToString();
var tabName = args["tabName"].ToString();
var source = CPH.GetSource();
var gsurl = "https://sheets.googleapis.com/v4/spreadsheets/" + sheetid + "/values/" + tabName + "!" + cells + "?key=" + apikey;
using (WebClient client = new WebClient())
{
string gsheets = client.DownloadString(gsurl);
Sheets sheets = JsonConvert.DeserializeObject<Sheets>(gsheets);
List<string> sheetsValues = new List<string>();
if (source == EventSource.Twitch)
{
for (int i = 0; i < sheets.values.Count; i++)
{
string values = string.Join(",", sheets.values[i]);
sheetsValues.Add(values);
CPH.SendMessage(user + " the data is: " + values);
}
string gsvalues = string.Join(",", sheetsValues);
CPH.SetArgument("sheetsValues", gsvalues);
}
if (source == EventSource.YouTube)
{
for (int i = 0; i < sheets.values.Count; i++)
{
string values = string.Join(",", sheets.values[i]);
sheetsValues.Add(values);
CPH.SendYouTubeMessage(user + " the data is: " + values);
}
string gsvalues = string.Join(",", sheetsValues);
CPH.SetArgument("sheetsValues", gsvalues);
}
}
return true;
}
}