Skip to content

Instantly share code, notes, and snippets.

@AlexKorovyansky
Created January 12, 2020 18:15
Show Gist options
  • Select an option

  • Save AlexKorovyansky/c1e4d0c8fa7af8116ad5edd3c2e17856 to your computer and use it in GitHub Desktop.

Select an option

Save AlexKorovyansky/c1e4d0c8fa7af8116ad5edd3c2e17856 to your computer and use it in GitHub Desktop.

Revisions

  1. AlexKorovyansky created this gist Jan 12, 2020.
    22 changes: 22 additions & 0 deletions append_to_spreadsheet.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    final _credentials = new ServiceAccountCredentials.fromJson(r'''
    {
    "private_key_id": "***",
    "private_key": "***",
    "client_email": "***",
    "client_id": "***",
    "type": "***"
    }
    ''');

    const _SCOPES = const [SheetsApi.SpreadsheetsScope];

    clientViaServiceAccount(_credentials, _SCOPES).then((httpClient) {
    var sheetsApi = new SheetsApi(httpClient);
    sheetsApi.spreadsheets.values.append(
    ValueRange.fromJson({"values": [["QR", "Авангард", "цвет формы", "#игрока", "фамилия игрока"]]}),
    "<spreadsheet_id",
    "A1:Z998",
    valueInputOption: "USER_ENTERED").then((response){
    print('it works!');
    });
    });