小编Neo*_*itz的帖子

C#Google API(SheetsServices)插入新行

我如何在我的谷歌电子表格中插入新行.

使用Google API(SheetsServices).

class GoogleAPI
    {
        // If modifying these scopes, delete your previously saved credentials
        // at ~/.credentials/sheets.googleapis.com-dotnet-quickstart.json
        static string[] Scopes = { SheetsService.Scope.Spreadsheets, "email" };
        static string ApplicationName = "Google Sheets API .NET Quickstart";

        public GoogleAPI()
        {
            UserCredential credential;

            using (var stream =
                new FileStream("Secret.json", FileMode.Open, FileAccess.Read))
            {
                string credPath = System.Environment.GetFolderPath(
                    System.Environment.SpecialFolder.Personal);
                credPath = Path.Combine(credPath, ".credentials/Secret.json");

                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    Scopes,
                    "user",
                    CancellationToken.None,
                    new FileDataStore(credPath, true)).Result;  
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Google …
Run Code Online (Sandbox Code Playgroud)

c# google-api

1
推荐指数
1
解决办法
1551
查看次数

标签 统计

c# ×1

google-api ×1