2014-07-18 2 views
1

다음은이 스크립트에서 수행 할 작업의 목록입니다.생성 된 PDF를 Google 드라이브의 특정 폴더로 이동하는 방법

사용자는 구글이 양식 구글 시트에 기록 시트가 텍스트를 대체하고 템플릿이 PDF가 PDF 특정 폴더로 이동됩니다 이메일로 전송되어이 템플릿에서 생성되는 PDF를 복사 템플릿에서 구글 문서를 생성 양식 사용 양식을 제출 Google 드라이브에 있습니다.

나는 마지막 단계를 제외하고는 모두 작동해야합니다. 누군가 우리를 도울 수 있습니까? 우리는 이것을 학교에 사용하고 있으며 우리 (IT) 부서의 누구도 스크립트에 대해 아무 것도 모른다. 인터넷 검색과 검색을 통해 나는 지금까지이 사실을 알게되었습니다. 마지막 단계는 PDF를 특정 폴더로 이동시키는 것입니다. 대신 임시 문서를 삭제하는, 내가 Google 드라이브에서 특정 파일로 이동하려는 ****

// MacArthur High School 
// Generic PLC Agenda Script 
// Created 18 Jul 2014 
// Author: Josh Patrick 
// Decatur Public Schools #61 

// Document Creation - replace docTemplate links with each template link on the PLC Drive. 

var docTemplate = "1DSFCE6mFZib0ZTVOgVqPbLYaRwjS-XNsnsZn5RZewsE"; 
var docName = "PLC Agenda"; 

// Form Functions (labeled identifiers for Form) 

function onFormSubmit(e) { 
    var TimeStamp = e.values [0] 
    var MeetingDate = e.values [1]; 
    var MeetingTime = e.values [2]; 
    var MeetingLocation = e.values [3]; 
    var PLCFocus = e.values [4]; 
    var PlannedActions = e.values [5]; 
    var ResourcesNeeded = e.values [6]; 
    var AssignedEmail = "[email protected]"; 

// Get document template, copy it as a new temp doc, and save the Doc’s id 
var copyId = DocsList.getFileById(docTemplate) 
.makeCopy(docName+' for '+ MeetingDate) 
.getId(); 


// Open the temporary document 
var copyDoc = DocumentApp.openById(copyId); 

// Get the document’s body section 
var copyBody = copyDoc.getActiveSection(); 

// Replacing Text with Form Information 

copyBody.replaceText('keyMeetingDate', MeetingDate); 
copyBody.replaceText('keyMeetingTime', MeetingTime); 
copyBody.replaceText('keyMeetingLocation', MeetingLocation); 
copyBody.replaceText('keyPLCFocus' , PLCFocus); 
copyBody.replaceText('keyPlannedActions' , PlannedActions); 
copyBody.replaceText('keyResourcesNeeded' ResourcesNeeded); 


// Copy Document and Save 

copyDoc.saveAndClose(); 

// Generate PDF 
var pdf = DocsList.getFileById(copyId).getAs("application/pdf"); 

// Email 
var subject = "ELA PLC Agenda for " + MeetingDate ; 
var body = "Attached is the PDF copy of the ELA PLC Agenda for " + MeetingDate; 
MailApp.sendEmail(AssignedEmail, subject, body, {htmlBody: body, attachments: pdf}); 

// Delete Temporary Document 
DocsList.getFileById(copyId).setTrashed(true); 
} 

:

여기에 현재 코드입니다. 스크립트 도움말을 찾았지만 올바르게 작성했다고는 생각하지 않습니다. 나는 그것을 copydoc에 줄 수 있지만, 나는 그것을 올바른 폴더로 옮길 수 없다.

모든 도움을 주시면 감사하겠습니다.

답변

1
+0

어떻게 작동하는지 혼란 스럽습니다. 난 그냥 폴더에 삭제되면 임시 PDF 파일을 이동할 수있는 방법을 알아야합니다. 그게 어떻게 작동하는지 모르겠습니다. (어쩌면 내가 잘못 찾고있는 단계 또는 단계를 놓치고) – user3853429

+0

@ user3853429 여기에 addToFolder 매우 직관적 인 사용을 발견 : http://stackoverflow.com/questions/11494223/addtofolder-the-copy-version-of 원본 파일 인 경우 삭제 된 파일입니다. –

관련 문제