Make Online Student ID Card by Google Form

 

How to Make Online Student ID Card by Google Form and Web App Script

In this blog, we will tell you how the student's ID card is made online automatically. Therefore, you read the entire blog carefully and learn to make the student's ID card according to the given guidelines.

 


Step 1 :- Copy Google Sheet Google Sheet Copy

 

Step 2 :- Click to >> Extensions >> App Script >>



Step 3 :- Create Two File 
code.gs
index.html


Step 4 :- Copy of code and Paste to Code.gs File

Code.gs

function doGet(e) {
  
  return HtmlService.createTemplateFromFile("Index").evaluate()
  .setTitle("ID Card")
  .addMetaTag('viewport', 'width=device-width, initial-scale=1')
  .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}


/* PROCESS FORM */
function processForm(formObject){ 
  var concat = formObject.searchtext+formObject.searchtext2;
  var result = "";
  if(concat){//Execute if form passes search text
      result = search(concat);
  }
  return result;
}

//SEARCH FOR MATCHED CONTENTS ;
function search(searchtext){
  var spreadsheetId   = 'Paste Google Sheet ID'; //** CHANGE !!!!
  var sheetName = "Data"
  var range = SpreadsheetApp.openById(spreadsheetId).getSheetByName(sheetName).getDataRange();
  var data = range.getValues();
  var ar = [];
  
  data.forEach(function(f) {
    if (~[f[5]].indexOf(searchtext)) {
      ar.push([f[2],f[3],f[4]]);
    }
  });
                                           
  return ar;
};

 

Step 5 :- Copy of Index file and Paste to index.html file

index.html


function doGet(e) {

  

  return HtmlService.createTemplateFromFile("Index").evaluate()

  .setTitle("ID Card")

  .addMetaTag('viewport', 'width=device-width, initial-scale=1')

  .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);

}



/* PROCESS FORM */

function processForm(formObject){ 

  var concat = formObject.searchtext+formObject.searchtext2;

  var result = "";

  if(concat){//Execute if form passes search text

      result = search(concat);

  }

  return result;

}


//SEARCH FOR MATCHED CONTENTS ;

function search(searchtext){

  var spreadsheetId   = 'Paste Google Sheet ID'; //** CHANGE !!!!

  var sheetName = "Data"

  var range = SpreadsheetApp.openById(spreadsheetId).getSheetByName(sheetName).getDataRange();

  var data = range.getValues();

  var ar = [];

  

  data.forEach(function(f) {

    if (~[f[5]].indexOf(searchtext)) {

      ar.push([f[2],f[3],f[4]]);

    }

  });

                                           

  return ar;

};



Step 6 :- Code.gs Line No 22  Paste your Google Sheet ID

Example :- https://docs.google.com/spreadsheets/d/Google Sheet ID/edit#gid=0



Step 7 :- Copy ID Card Template Template Copy

 

 

Step 8 :- Google Form Copy Google Form

 

Step 9 :- Click to Google Sheet >> Extensions >> Add-ons >> Get Add-ons >>

Search AutoCrat and Install

 

More Detail See Video :-




ที่มาครูสมชายคัดมาจาก : {getButton} $text={อ้างอิงที่มา} $icon={link} $color={red}
>>>TRY TO CHECK OUT , IF ANY ERROR FOUND. PLEASE LET ME KNOW BY COMMENT.
I'LL TRY MY LEVEL BEST TO FIX THE PROBLEM.
                                                                THANKS FOR VISITING thumariya.blogspot
                                                Have a nice day!
-------------------------- -------------------------
>>>ลองตรวจสอบหากพบข้อผิดพลาด โปรดแจ้งให้เราทราบโดยแสดงความคิดเห็น
ฉันจะพยายามระดับของฉันให้ดีที่สุดเพื่อแก้ไขปัญหา
ขอบคุณสำหรับการเยี่ยมชม thumariya.blogspot
ขอให้เป็นวันที่ดี!
-------------------------- -------------------------


แสดงความคิดเห็น (0)
ใหม่กว่า เก่ากว่า