function doGet(req) {
var service = req.parameter.service;
var doc = SpreadsheetApp.getActiveSpreadsheet();
var sheet = doc.getSheetByName('sheet_name');
var values = sheet.getDataRange().getValues();
var output = [];
for(var i=0; i<values.length; i++)
{
var row = {};
row['first_column'] = values[i][0];
row['second_column'] = values[i][1];
row['service'] = values[i][2]; //thirdcolumn
output.push(row);
}
if(service !=null){
var outputToReturn = output.filter(obj => obj.service.toLowerCase().includes(service.toLowerCase()));
return ContentService.createTextOutput(JSON.stringify({data: outputToReturn})).setMimeType(ContentService.MimeType.JSON);
}
return ContentService.createTextOutput(JSON.stringify({data: output})).setMimeType(ContentService.MimeType.JSON);
}
<script>
fetch('scripturl')
.then(res => res.json())
.then(data => console.log(data));
</script>