Skip to content

Instantly share code, notes, and snippets.

@betillogalvanfbc
Last active June 18, 2020 19:57
Show Gist options
  • Save betillogalvanfbc/e23f891a52bc3b8553af5333f597bbc5 to your computer and use it in GitHub Desktop.
Save betillogalvanfbc/e23f891a52bc3b8553af5333f597bbc5 to your computer and use it in GitHub Desktop.
Simple way to use data from google sheets with C# + RestSharp
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using RestSharp;
namespace ProcessFile
{
class Program
{
static void Main(string[] args)
{
var sheetid = "";
var client = new RestClient("https://docs.google.com");
var request = new RestRequest($"/spreadsheets/d/{sheetid}/export?format=csv",Method.GET);
var response = client.Execute(request);
string[] stringSeparators = new string[] { "\r\n" };
string[] lines = response.Content.Split(stringSeparators, StringSplitOptions.None);
foreach (string s in lines)
{
Console.WriteLine(s);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment