Spaces:
Runtime error
Runtime error
Download google_ut/appscript from abhishek2406/question_Paper: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/abhishek2406/question_Paper/resolve/main/google_ut/appscript
- Command line
-
hf download hf://spaces/abhishek2406/question_Paper/google_ut/appscript
-
curl -L -o appscript https://huggingface.co/spaces/abhishek2406/question_Paper/resolve/main/google_ut/appscript
1.09 kB
| function doPost(e) { | |
| try { | |
| const data = JSON.parse(e.postData.contents); | |
| const form = FormApp.create(`${data.paper_name} Quiz - Class ${data.class_grade}`); | |
| form.setIsQuiz(true); // Enable quiz mode | |
| const allQuestions = data.all_questions; | |
| allQuestions.forEach(section => { | |
| section.questions.forEach(q => { | |
| const item = form.addMultipleChoiceItem(); | |
| item.setTitle(q.question) | |
| .setChoices(q.options.map(opt => item.createChoice(opt, opt === q.answer))) | |
| .setRequired(true); | |
| }); | |
| }); | |
| Logger.log("Form created: " + form.getEditUrl()); // ✅ Added for manual access | |
| return ContentService.createTextOutput(JSON.stringify({ | |
| success: true, | |
| message: "Form created successfully", | |
| editUrl: form.getEditUrl(), | |
| publicUrl: form.getPublishedUrl() | |
| })).setMimeType(ContentService.MimeType.JSON); | |
| } catch (error) { | |
| return ContentService.createTextOutput(JSON.stringify({ | |
| success: false, | |
| error: error.message | |
| })).setMimeType(ContentService.MimeType.JSON); | |
| } | |
| } | |