私はシンプルなGoogle Scriptを使用していますが、動作させようとしていますが、エラーを理解できないようです。同じスプレッドシート内の別のセルにセル値を移動
この関数は、空白のセルが見つかった後で、スプレッドシートの1つのセクションから別のセクションに太字ではないテキストを移動します。
私は値が太字太字やない重み付けされている場合、私は、値を取得することができます検証し、空のセルの場所が、私はテキストを移動しようとすると、私はこのエラーメッセージを取得しました:
をTypeError: Cannot find function copyTo in object AS.
私は私のエラーは、このラインから知っている:
matchedCell.getValue().copyTo((emptyCellLocation,1,1,1),{contentsOnly:true});
提案?数値、文字列、またはそのようなこと:
function moveLowerValues() {
var s = SpreadsheetApp.getActiveSheet();
// Set values for position of cells to examine
var upperRowStart = 1;
var columnStart = 1;
var upperRange = s.getRange(upperRowStart, columnStart, 10);
var upperValues = upperRange.getValues(); // Get all data in one call
var emptyCellLocation = 1;
while (upperValues[emptyCellLocation][0] != "") {
emptyCellLocation++;
}
var lowerRowStart = 11;
var lowerRange = s.getRange(lowerRowStart, columnStart, 10);
var lowerValues = lowerRange.getValues();
var lowerWeight = lowerRange.getFontWeights();
// Move and clear cells which are not bold
for (var rowStartOffset=0; rowStartOffset < lowerValues.length; rowStartOffset++) {
// If the value of the cell does not equal bold, move and then delete it
if (lowerWeight[rowStartOffset].toString() != "bold") {
var matchedRow = lowerRowStart + rowStartOffset;
var matchedCell = s.getRange(matchedRow, columnStart, 1, 1);
matchedCell.getValue().copyTo((emptyCellLocation,1,1,1),{contentsOnly:true});
// emptyCellLocation++
// matchedCell.clear();
}
}
// lowerRange.sort(1);
}
これは私の間違いでした。ありがとう! – Chef1075