메뉴 건너뛰기

app

[GAS] 구글 폼에서 시트 값을 참조해 리스트에 적용

lispro062013.12.16 07:18조회 수 11985댓글 0

  • 2
    • 글자 크기
function myFunction() {
  var form = FormApp.openById('폼 아이디');적용할 폼
  var items = form.getItems();
  var item = items[2].getType();//리스트(옵션)- 목록에서 선택
  var list=items[2].asListItem();//아이템을 적용하기 위해 리스트 타입으로 설정
  var itemSpreadsheetKey = '시트 키';//폼에 넣을 데이터가 있는 시트의 키 값
  var openedSS = SpreadsheetApp.openById(itemSpreadsheetKey);//시트 열기
  var sheetList1 = openedSS.getSheetByName("List1");//시트 이름으로 시트 리스트 설정
  numItemList1 = sheetList1.getLastRow()-1;//-1 로 해더를 제외하는 옵션을 적용하고, 마지막 행을 통해 전체 리스트 개수 설정
   list1ItemArray = sheetList1.getRange(2,1,numItemList1,1).getValues();//리스트를 배열로 설정
   list.setChoiceValues(list1ItemArray);//매소드 호출로 리스트 배열로 설정한 값을 지정
}

스크린샷 2013-12-15 오후 10.18.32.png

스크린샷 2013-12-15 오후 10.19.18.png
lispro06 (비회원)
  • 2
    • 글자 크기

댓글 달기

suritam9
2013.04.25 조회 6115
suritam9
2013.04.04 조회 2197
suritam9
2012.09.14 조회 2515
suritam9
2012.06.24 조회 2366
suritam9
2012.06.24 조회 2777
suritam9
2012.06.24 조회 2538
suritam9
2012.06.22 조회 2582
박영식
2011.09.22 조회 2544
박영식
2011.09.21 조회 2488
박영식
2011.02.18 조회 2964
박영식
2010.09.29 조회 4757
첨부 (2)
스크린샷 2013-12-15 오후 10.18.32.png
15.3KB / Download 113
스크린샷 2013-12-15 오후 10.19.18.png
32.8KB / Download 95
위로