Last active
June 18, 2020 19:57
-
-
Save betillogalvanfbc/e23f891a52bc3b8553af5333f597bbc5 to your computer and use it in GitHub Desktop.
Simple way to use data from google sheets with C# + RestSharp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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