If you want your App (front-end) to access the spreadsheet (backend) the same way a sidebar would act, you have to create all that functionality within the frontend app.
Here is a partial example from an App I have. A user clicks on a button (front-end) to edit some content, then it sends the data to the backend sheet via google.script.run.
backendFunctionNameI
//front-end javascript
async function editRemarks(gid) {
var remarks = $('#remarkSpan').text(); //using Jquery on frontend
var updatedRemarks = prompt("Enter new Remarks", remarks);
$('#remarkSpan').text(updatedRemarks);
await google.script.run
.withSuccessHandler(function(contents) {
// Respond to success conditions here.
loadSites(); //calls frontend function to reload the page
})
.withFailureHandler(function(msg) {
// Respond to failure conditions here.
$('#remarks').text(msg);
})
.updateRemarks(gid, updatedRemarks ); //pass new remark to spreadsheet
}
=======================================
//backend Apps script in Code.gs
function updateRemarks(gid, remarks) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var ws = ss.getSheetByName('sites');
var rawSites = ws.getRange(2, 10, ws.getLastRow() -1, 1).getValues();
var aRow = 1;
// var sites = rawSites.indexOf(gid);
// console.log( rawSites[0][0], rawSites[1][0] );
var blankRemark = "";
if (remarks === null || remarks === '') {
remarks = blankRemark;
}
rawSites.forEach( (site) => {
aRow++
if(site[0].toString() === gid) {
ws.getRange(aRow, 6).setValue(remarks);
}
})
}