Search results
Top results related to create a google docs quiz
Top Answer
Answered Jun 13, 2017 · 0 votes
In the case of creating Google Docs, it uses DocumentApp or Drive API. And when Google Docs are created, there are 2 methods for creating it in a subfolder.
Method 1
In this method, a document is created by DocumentApp.create() and changed the parents (folder) from initial folder (root folder) to MyWorkingFolder.
Script :
var doc = DocumentApp.create('FileName');doc.getBody().editAsText().insertText(0, 'Text in the File');var file = DriveApp.getFileById(doc.getId());var destfolder = DriveApp.createFolder('MyWorkingFolder');var sourcefolder = file.getParents().next();destfolder.addFile(file);sourcefolder.removeFile(file);-
Method 2
In this method, a document is created by Drive API. In this case, when the document is created, the document is directly created to the subfolder MyWorkingFolder.
Script :
DocumentApp.openById(Drive.Files.insert({ "title": "FileName", "mimeType": "application/vnd.google-apps.document", "parents": [{"id": DriveApp.createFolder('MyWorkingFolder').getId()}]}).id).getBody().editAsText().insertText(0, 'Text in the File');-
Note :
When you use Drive API, please enable Drive API on Google API Console as follows.
- In the script editor, select Resources > Cloud Platform Project
- At the bottom of the dialog, click the link for the Google API Console.
- In the console, click into the filter box and type part of the name of the API "Drive API", then click the name once you see it.
- On the next screen, click Enable API.
- Close the Developers Console and return to the script editor. Click OK in the dialog.
If I misunderstand your question, I'm sorry.
1/5
Top Answer
Answered Mar 16, 2020 · 0 votes
You are having that error because even if you are using the right scope (DocsScopes.DOCUMENTS), you must delete your StoredCredential file (it's in the tokens folder) in order to refresh the authorization information by doing the Oauth process again and in that way the new scope will be set.
Notice
You will not be able to create 300 docs in just one run unless you take some precautions because of what the Docs API Quotas state:
- Write requests: 600 per project per 60 seconds
- 60 per user per 60 seconds
2/5
Top Answer
Answered Jul 31, 2015 · 26 votes
The other answer is correct but the file will exist in your folder AND in your "drive" folder (the root folder).
To avoid that, simply remove it from there !
code :
var doc = DocumentApp.create('Document Name'), docFile = DriveApp.getFileById( doc.getId() ); DriveApp.getFolderById('0B3°°°°°°°1lXWkk').addFile( docFile ); DriveApp.getRootFolder().removeFile(docFile);
Other Answers
Answered Jul 31, 2015 · 9 votes
With document it's a bit different, you first create it then move to the folder:
var doc = DocumentApp.create('Document Name'), docFile = DriveApp.getFileById( doc.getId() );DriveApp.getFolderById(foldId).addFile( docFile );
Other Answers
Answered Nov 27, 2018 · 3 votes
This is how to create a new Google Doc in a specific folder. When the Doc is created, the mime type must be set.
Note that this code does NOT first create a Doc file, move it, and then delete the file in the Root Drive. This code creates a new Google Doc type file directly in a folder.
You will need to use the Advanced Drive API. It must be enabled in two places.
- From the code editor choose "Resources" and then choose, "Advanced Google services"
- Click the button for "Drive API" so that it is ON.
- Click the link: Google Cloud Platform API Dashboard.
- Search Drive API
- Choose Google Drive API from search list
- Enable the Drive API
Code:
function myFunction(e) { var doc,fileResource,folder,ID_of_newFile,multipleFolders,newFile, newDocName,rng,sh,ss,ssFile,ssID; var name = e.values[1]; var kantoor = e.values[2]; newDocName = 'Sleuteloverdracht ' + name;//Set the name of the new file rng = e.range;//Get range in the spreadsheet that received the data sh = rng.getSheet();//Get sheet tab ss = sh.getParent();//Get spreadsheet ssID = ss.getSheetId();//Get file ID of spreadsheet - Integer ssFile = DriveApp.getFileById(ssID);//Get the spreadsheet file in order to get the //folder to put the new file in multipleFolders = ssFile.getParents();//Get all parent folders of the spreadsheet file folder = multipleFolders.next();//Get the folder of the spreadsheet fileResource = { 'title': newDocName, "parents": [{'id':folder.getId()}], //<--By setting this parent ID to the //folder's ID, it creates this file in the correct folder 'mimeType': 'application/vnd.google-apps.document' }; newFile = Drive.Files.insert(fileResource);//Create the new document file // directly into the same folder as the spreadsheet ID_of_newFile = newFile.getId(); //Logger.log(ID_of_newFile) doc = DocumentApp.openById(newFile.getId());//Open the new file as a Google document var body = doc.getBody(); body.appendParagraph('Sleuteloverdracht ' + name); body.appendParagraph('Uw naam is '+ name + '\n' + 'U heeft de sleutel van kantoor '+ kantoor); doc.saveAndClose();}
3/5
Top Answer
Answered Feb 06, 2017 · 9 votes
Since DocsList is deprecated, currently the following solution works:
var folder=DriveApp.getFoldersByName(folderName).next();//gets first folder with the given foldernamevar file=SpreadsheetApp.create(fileName);var copyFile=DriveApp.getFileById(file.getId());folder.addFile(copyFile);DriveApp.getRootFolder().removeFile(copyFile);
Other Answers
Answered Jul 31, 2015 · 9 votes
With document it's a bit different, you first create it then move to the folder:
var doc = DocumentApp.create('Document Name'), docFile = DriveApp.getFileById( doc.getId() );-DriveApp.getFolderById(foldId).addFile( docFile );-
Other Answers
Answered Nov 27, 2018 · 3 votes
This is how to create a new Google Doc in a specific folder. When the Doc is created, the mime type must be set.
Note that this code does NOT first create a Doc file, move it, and then delete the file in the Root Drive. This code creates a new Google Doc type file directly in a folder.
You will need to use the Advanced Drive API. It must be enabled in two places.
- From the code editor choose "Resources" and then choose, "Advanced Google services"
- Click the button for "Drive API" so that it is ON.
- Click the link: Google Cloud Platform API Dashboard.
- Search Drive API
- Choose Google Drive API from search list
- Enable the Drive API
Code:
function myFunction(e) { var doc,fileResource,folder,ID_of_newFile,multipleFolders,newFile, newDocName,rng,sh,ss,ssFile,ssID;- var name = e.values[1]; var kantoor = e.values[2]; newDocName = 'Sleuteloverdracht ' + name;//Set the name of the new file rng = e.range;//Get range in the spreadsheet that received the data sh = rng.getSheet();//Get sheet tab ss = sh.getParent();//Get spreadsheet ssID = ss.getSheetId();//Get file ID of spreadsheet - Integer ssFile = DriveApp.getFileById(ssID);//Get the spreadsheet file in order to get the //folder to put the new file in multipleFolders = ssFile.getParents();//Get all parent folders of the spreadsheet file folder = multipleFolders.next();//Get the folder of the spreadsheet fileResource = { 'title': newDocName, "parents": [{'id':folder.getId()}], //<--By setting this parent ID to the //folder's ID, it creates this file in the correct folder 'mimeType': 'application/vnd.google-apps.document' }; newFile = Drive.Files.insert(fileResource);//Create the new document file // directly into the same folder as the spreadsheet ID_of_newFile = newFile.getId(); //Logger.log(ID_of_newFile) doc = DocumentApp.openById(newFile.getId());//Open the new file as a Google document var body = doc.getBody(); body.appendParagraph('Sleuteloverdracht ' + name); body.appendParagraph('Uw naam is '+ name + '\n' + 'U heeft de sleutel van kantoor '+ kantoor); doc.saveAndClose();}
4/5
Top Answer
Answered Dec 29, 2012 · 1 votes
the statement getRow() returns an integer, the number of the row of that range, what you want is the value of the 22cd cell in that row , so try
var sourceRow = sourceSheet.getActiveRange().getRow(); var sourceRowValue = sourceSheet.getRange(sourceRow,1,1,sourceSheet.getMaxColumn()).getValues();-
and then to get the cell value condition :
if (sourceRowValue[0][21]=="Yes") {; ...-
The result of getValues() is always a 2 dimension array, that's the reason for the [0] and is 0 indexed >> changed to 21
Note that I guess your code could be simpler if you use sourceSheet.getActiveCell().getValue() which returns directly the value of the cell you are writing to...
try this small example where I get the Value and the column index:
function onEdit(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var cellValue = ss.getActiveCell().getValue()ss.getRange('A1').setValue(cellValue+' in col '+ss.getActiveCell().getColumn())}
5/5
support.google.com › a › usersCreate a quiz with Google Forms
support.google.com › a › usersCreate a quiz. Tip: The quickest way to create a quiz is to go to g.co/createaquiz . Open a form in Google Forms. At the top of the form, click Settings. Turn on Make this a quiz . Optional: To...
support.google.com › docs › answerCreate & grade quizzes with Google Forms - Google Docs ...
support.google.com › docs › answerCreate, edit, and format. Create & grade quizzes with Google Forms. Make a new quiz & answer key. Tip: The quickest way to create a quiz is to go to g.co/createaquiz . Open a...
www.geeksforgeeks.org › how-to-create-quiz-inHow to Create Quiz in Google Docs - GeeksforGeeks
www.geeksforgeeks.org › how-to-create-quiz-inMay 4, 2024 · Learn how to create engaging quizzes in Google Docs effortlessly. Step-by-step guide to craft interactive assessments for various purposes.
docs.google.com › forms › createquizGoogle Forms: Sign-in
docs.google.com › forms › createquizCreate account. Access Google Forms with a personal Google account or Google Workspace account (for business use).
docs.google.com › document › dCreating a Quiz in Google Documents - Google Docs - Google Sheets
docs.google.com › document › dCreating a Quiz in Google Documents. You must first create a Google account to utilize Google-Docs. Creating/Accessing an Account: Go to www.google.com. Along the top, left-hand side...
www.solveyourtech.com › how-to-create-a-googleHow to Create a Google Forms Quiz: A Step-by-Step Guide
www.solveyourtech.com › how-to-create-a-googleApr 4, 2024 · Creating a Google Forms quiz is a simple and effective way to assess students, gather feedback, or even run a fun quiz for friends and family. Here’s how you do it: First, go to Google Forms and start a new form. Then, add questions, set correct answers, and assign point values.
youengage.me › blog › how-to-make-a-quiz-on-googleHow to Make a Quiz on Google Docs: The Ultimate Guide
youengage.me › blog › how-to-make-a-quiz-on-googleCreating a quiz on Google Docs is a relatively simple process. Using the Forms tool, you create quizzes that are automatically graded. It can be a great way to assess student understanding or create practice quizzes for students – but it’s not always ideal.
Searches related to create a google docs quiz
google drive google google slides