Skip to content

Instantly share code, notes, and snippets.

@Tomokatsu-Sakamoto
Last active February 18, 2022 04:39
Show Gist options
  • Save Tomokatsu-Sakamoto/8f6bb98051c765274c50bafdad365446 to your computer and use it in GitHub Desktop.
Save Tomokatsu-Sakamoto/8f6bb98051c765274c50bafdad365446 to your computer and use it in GitHub Desktop.
var value;
function myFunction( ) {
var sheet = SpreadsheetApp.getActive( ); // スプレッドシート
var cellNow = sheet.getCurrentCell( ).getValue( );
Logger.log( 'セルの内容 : [' + cellNow + ']' );
Logger.log( '変数の内容1 : [' + value + '] , [' + Number( cellNow ) + ']' );
if ( value == undefined ) {
value = 0;
Logger.log( '変数の内容1 : [' + value + '] , [' + Number( cellNow ) + ']' );
}
value = value + Number( cellNow );
Logger.log( '変数の内容2 : [' + value + ']' );
sheet.getCurrentCell( ).setValue( cellNow );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment