function doGet() {
// Get the sheet data
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
// Create HTML structure for marksheet
var html = HtmlService.createHtmlOutput('')
.setTitle('Marksheet')
.setWidth(800)
.setHeight(600);
html.append('
Marksheet
');
html.append('
');
html.append('Name | Roll No. | Subject 1 | ' +
'Subject 2 | ' +
'Total | Percentage |
');
for (var i = 1; i < data.length; i++) { // Skip the header row
var row = data[i];
var total = calculateTotal(row);
var percentage = calculatePercentage(total);
html.append('' + row[0] + ' | ' + row[1] + ' | ' +
'' + row[2] + ' | ' + row[3] + ' | ' +
'' + total + ' | ' + percentage + '% |
');
}
html.append('
');
return html;
}
// Helper functions for calculations
function calculateTotal(row) {
// Add up marks for each subject
// ...
}
function calculatePercentage(total) {
// Calculate percentage based on total marks
// ...
}