Google 스크립트를 통해 문서를 만들고 미리 지정된 공유 파일 폴더에 자동으로 넣어 다른 사람이 열 수 있도록 할 수있는 방법이 있습니까? 이 문서를 만들기 위해 양식 스프레드 시트의 결과를 사용하고 있지만 Google 스크립트의 한 측면에 문제가 있습니다.이메일 보내기를위한 Google 스크립트
0
A
답변
0
당신은 파일을 편집하기 위해 이메일 권한의 수신자를 제공 할 수 있습니다 :
file.addEditor(emailtogoto);
을 ... 아니면 그냥 볼 다음 이름이 공유 폴더의 인 경우
file.addViewer(emailtogoto);
'우리 파일 폴더'는 아마도 DocsList.getFolderById()
을 의미하지는 않습니다.
var sharedFolder = DocsList.getFolder('OUR FILE FOLDER');
당신은 직접 구글 문서를 첨부 할 수 없습니다,하지만 당신은 PDF 버전을 첨부 할 수 있습니다 : 대신 DocsList.getFolder(path)
를 사용한다.
var pdf = file.getAs("application/pdf");
MailApp.sendEmail(emailtogoto, 'Thank you for your using this form! Here is your file', file.getName()+'\n'+file.getUrl(), {attachments: pdf});
0
내가 DocumentApp과 DocsList 서비스에서 사용할 수있는 모든 기능을 보여주기 위해 얼마 전이 샘플 스크립트를 작성, 난 당신이
(코드에 주석을 참조)이 설명하는 유스 케이스에 필요한 모든 것을 포함하고 생각function testDocCreate(){
try{
var folder = DocsList.getFolder("testFolder"); // check if shared folder already exist, if not just do it !
}catch(err){
folder = DocsList.createFolder("testFolder").addEditor('editorEmailAdress');// or addViewer ...
}
// now that our shared testfolder exists we van create files in it that will inherit all sharing properties
var fileId = DocumentApp.create('testFileName').getId();// create as a text document
var fileUrl = DocsList.getFileById(fileId).getUrl();
var file = DocsList.getFileById(fileId);
file.addToFolder(folder); // share it by moving into the right folder
file.removeFromFolder(DocsList.getRootFolder());// remove the newly created file from your root folder so it won't appear twice
Logger.log(fileUrl); // send this url to your user and eventually add a pdf copy to your email like below
var pdf = DocsList.getFileById(fileId).getAs('application/pdf').getBytes(); // this is the pdf file
var attach_to_send = {fileName: 'testFileName.pdf',content:pdf, mimeType:'application/pdf'}; // create an attachment object
MailApp.sendEmail('editorEmailAdress', "here is the document I've shared with you (url & pdf copy)", 'Your doc available here : '+fileUrl, {attachments:[attach_to_send]});
}
관련 문제
- 1. 매월 Google 스크립트 자동 이메일
- 2. 파일 보내기를위한 OpenTok 신호
- 3. Google 스크립트 mailapp.sendEmail은 내 이메일 주소에서만 작동합니다
- 4. Google Apps 스크립트 트리거 이메일 알림
- 5. Google 애플리케이션 스크립트 - 이메일 재 다이얼
- 6. 메일 보내기를위한 알림 서비스 구현
- 7. google app 스크립트 및 google 양식을 사용하여 이메일 확인
- 8. 이메일 스크립트
- 9. 이메일 주소의 자바 스크립트 'cvml'
- 10. Google 이메일/Heroku 호스팅/이메일 전송 실패
- 11. Google Script 이메일
- 12. Google Compute 이메일 전달
- 13. google docs의 이메일
- 14. Google 양식의 이메일 확인
- 15. Google+ API 이메일 범위
- 16. Google Apps 이메일 할당량
- 17. Google 스프레드 시트 이메일
- 18. Google 스프레드 시트 이메일
- 19. 보안 PHP 이메일 스크립트
- 20. 이메일 스팸 방지 스크립트
- 21. Python 스크립트 진행 이메일
- 22. PHP 스크립트 느린 이메일
- 23. 이메일 정규식 자바 스크립트
- 24. 이메일 스크립트 PHP
- 25. Windows 프로그래밍 - 이메일 스크립트
- 26. 자바 스크립트 이메일 linebreaks
- 27. ASP 이메일 스크립트
- 28. Google Apps 관리 스크립트 앱 | 관리자가 아닌 이메일 전달
- 29. Google 스크립트 내에서 자동 이메일 변경 워크 플로 앱
- 30. 새 이메일 (Google Apps/Gmail)에 PHP 스크립트 트리거