Skip to content

Instantly share code, notes, and snippets.

@sironekotoro
Last active October 15, 2020 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sironekotoro/4f3194d6a983f1840e2f263c5a5c8cc8 to your computer and use it in GitHub Desktop.
Save sironekotoro/4f3194d6a983f1840e2f263c5a5c8cc8 to your computer and use it in GitHub Desktop.
Net::Google::Spreadsheets::V4 からGoogle Sheet 更新
#!/usr/bin/env perl
use strict;
use warnings;
# https://twitter.com/sironekotoro/status/1316671830745214978?s=20
use utf8;
use Net::Google::Spreadsheets::V4;
my $CLIENT_ID = "";
my $CLIENT_SECRET = "";
my $REFRESH_TOKEN = "";
my $SPREADSHEET_ID = "";
my $gs = Net::Google::Spreadsheets::V4->new(
client_id => $CLIENT_ID,
client_secret => $CLIENT_SECRET,
refresh_token => $REFRESH_TOKEN,
spreadsheet_id => $SPREADSHEET_ID,
);
my ( $content, $res ) = $gs->request(
POST => ':batchUpdate',
{ requests => [
{ updateCells => {
start => {
sheetId => 0,
rowIndex => 0,
columnIndex => 0
},
rows => [
{ values => [
{ userEnteredValue => {
stringValue =>
'Perl入学式onlineは'
}
},
{ userEnteredValue => {
stringValue =>
'今週土曜日だよ!'
}
},
],
},
{ values => [
{ userEnteredValue => {
stringValue => '詳細はconnpassで'
}
},
{ userEnteredValue => {
stringValue =>
'Perl入学式onlineで検索!'
}
},
]
}
],
fields => "userEnteredValue"
}
},
]
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment