메뉴 건너뛰기

app

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

lispro062013.12.16 07:18조회 수 11251댓글 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
    • 글자 크기
[GAS] 문서 리스트 출력 및 뷰어 추가, 제거 (by lispro06) [GAS] 새 행 추가시 수식 복사 (by lispro06)

댓글 달기

lispro06
2014.08.16 조회 1606
lispro06
2014.02.08 조회 3845
lispro06
2013.12.11 조회 1516
lispro06
2013.12.10 조회 2773
suritam9
2013.12.06 조회 2088
suritam9
2013.12.02 조회 3211
이전 1 2 3 4 5 6 7 8 9 10... 15다음
첨부 (2)
스크린샷 2013-12-15 오후 10.18.32.png
15.3KB / Download 103
스크린샷 2013-12-15 오후 10.19.18.png
32.8KB / Download 88
위로