Last active
October 15, 2020 09:27
-
-
Save sironekotoro/4f3194d6a983f1840e2f263c5a5c8cc8 to your computer and use it in GitHub Desktop.
Net::Google::Spreadsheets::V4 からGoogle Sheet 更新
This file contains 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
#!/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