ホーム

GAS - Get the number of characters in a specified cell

Examine the spreadsheet using GAS

It is a script that gets a cell in the specified range and checks how many character strings are entered in the range of that cell. Numbers are not counted: A: A wind and writing A can be monitored for writing.

  //Retrieve the current spreadsheet
  var ss_copyFrom = SpreadsheetApp.getActiveSheet();
 //Acquire line A
  var Avals = ss_copyFrom.getRange("A:A").getValues();
  // Get the number of strings (numbers excluded)
  var Alast = Avals.filter(String).length; 
  //Debug Confirmation in Log
  Logger.log(Alast);

If you want to get the string itself you should do as follows

  //Retrieve the current spreadsheet
  var ss_copyFrom = SpreadsheetApp.getActiveSheet();
  //Acquire line A
  var Avals = ss_copyFrom.getRange("A:A");
  // Get a character string (numbers are excluded)
  var Alast = Avals.filter(String).length; 
  //Debug Confirmation in Log
  Logger.log(Alast);

-ホーム

Copyright© off , 2020 All Rights Reserved Powered by AFFINGER5.