Google Apps Script를 사용하여 Google 스프레드 시트에서 특정 셀 행의 배경색을 변경하고 있습니다. 어떤 이유로 셀 범위의 함수로 실행하면 setBackgroundColor ( 'white')가 작동하고 setBackgroundColorTransparent ()는 "TypeError : not a function"메시지를 호출합니다. setBackgroundColorTransparent ()의 사용법이나 구문이 약간 누락 되었습니까?
내 코드 :
function colorSundays() {
var maxColumns = sheet.getMaxColumns();
for (i = 1; i <= 31; i++) {
var currentCell = sheet.getRange(i, 1);
var value = currentCell.getValues();
if (value == 'Sunday') {
var currentRow = sheet.getRange(i, 1, 1, maxColumns);
currentRow.setBackgroundColor('#F87CF8');
} else {
var currentRow = sheet.getRange(i, 1, 1, maxColumns);
// currentRow.setBackgroundColor('white');
currentRow.setBackgroundColorTransparent(); // Preferred, but now working right now.
}
}
}
오류 메시지 :
[20-06-08 19:09:04:246 CDT] TypeError: currentRow.setBackgroundColorTransparent is not a function
at colorSundays(Code:52:18)
at setThisMonth(Code:61:3)
나는 당신의 목표를 다음과 같이 믿습니다.
setBackgroundColorTransparent()
.이를 위해이 답변은 어떻습니까?
setBackgroundColorTransparent()
스프레드 시트 서비스에 포함되어 있지 않습니다. 나는 당신의 문제의 이유라고 생각합니다. 귀하의 경우 setBackgroundColorTransparent()
에는 Slides Service의 Class TextStyle 방법을 사용할 수 있다고 생각했습니다 . RefsetBackgroundColor
클래스 범위에 포함되지 않습니다. 이 경우를 사용하십시오 setBackground
.따라서 배경색을 기본값으로 설정하려면 다음 수정은 어떻습니까?
currentRow.setBackgroundColor('#F87CF8');
currentRow.setBackground('#F87CF8');
과
currentRow.setBackgroundColorTransparent();
currentRow.setBackground(null);
setBackgroundColor
클래스 범위에 포함되지 않습니다. 그러나 OP의 회신을 통해이 방법을 사용할 수 있음을 알 수 있었다.이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다