ChatGPT 사례 > apps script

2innnnn0·2023년 7월 16일
0

특정 위치의 열을 주기적으로 복사해서 붙여넣어야 하는 작업이 필요했다. 이를 chatGPT에게 물어보았다.

Make google spreadsheet Apps script code
this is how i want to made it.

- 1/ "insert 1 column left" at "I" column.
- 2/ copy "J" column to "I" column.

답변은 수정할 것 없이 정말 훌륭하게 작성해주었다.

function insertColumnAndCopy() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  
  // Step 1: Insert a column at I column
  sheet.insertColumnBefore(9);
  
  // Step 2: Copy J column to I column
  var rangeToCopy = sheet.getRange("J1:J" + sheet.getLastRow());
  var destinationRange = sheet.getRange("I1:I" + sheet.getLastRow());
  rangeToCopy.copyTo(destinationRange);
}

profile
성장하고 싶은 데이터분석가.

2개의 댓글

comment-user-thumbnail
2023년 7월 16일

잘봤습니다.

답글 달기
comment-user-thumbnail
2023년 7월 17일

저도 개발자인데 같이 교류 많이 해봐요 ㅎㅎ! 서로 화이팅합시다!

답글 달기