Home>

Spreadsheet responses that reflect google form responses
Automatically reflected in multiple separate sheets.

I want to pick up and distribute items in a specific column when reflecting to multiple separate sheets.
For example, if you enter items in Tokyo, Osaka, and Hokkaido in the "Containment Bureau" column,
The purpose is to automatically reflect the sheets in each region.

Error message

I don't know the code to pick up and distribute items in a specific row.

Applicable source code Tried

function copyValues ​​() {
var ss_copyFrom = SpreadsheetApp.getActiveSpreadsheet ();
var ss_copyTo = SpreadsheetApp.openById ('10oynFXMD1xBd4xhztzYauSgMQ0zJOWbukxXNqlIUZeA');
var sheet_copyFrom = ss_copyFrom.getSheetByName ('Form response');
var sheet_copyTo = ss_copyTo.getSheetByName ('Destination sheet ①');

var copyValue = sheet_copyFrom.getRange ('B2: P1005'). getValues ​​();
sheet_copyTo.getRange ('B2: P1005'). setValues ​​(copyValue);

Supplemental information (FW/tool version etc.)

Please provide more detailed information here.

  • Answer # 1

    Extract with

    filter.
    After that, you can get the number of rows in the array andgetRangefor the number of rows and usesetValues ​​.

    var copySetValue = copyValue.filter (function (x) {
      if (x [column number-1] == "item to extract") {
        return 1;
      }
      return 0;
    });

Related articles