Google opens the sheet's page. Tap Request access there (sign in to Google if it asks). The owner gets an email from Google and can say yes with one tap.
2
Once the owner says yes, come back and tap this. Sign in with the Google account you asked from.
Is this your own sheet? so your family can see it.
Enable Editing — Apps Script Setup
Open your Google Sheet.
Go to Extensions → Apps Script.
Replace any existing code with the script below and click Save.
Click Deploy → New deployment.
Choose type: Web app. Set "Execute as: Me" and "Who has access: Anyone".
Click Deploy, authorize, then copy the Web app URL.
Paste that URL into the "Apps Script URL" field on the setup screen.
function doPost(e) {
try {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
const data = JSON.parse(e.postData.contents);
const values = sheet.getDataRange().getValues();
function findRow(id) {
for (let i = 1; i < values.length; i++)
if (String(values[i][0]) === String(id)) return i + 1;
return -1;
}
if (data.action === 'updateSpouse') {
const row = findRow(data.id);
if (row === -1) return ok({ success: false, error: 'ID not found' });
sheet.getRange(row, 6).setValue(data.spouse);
return ok({ success: true });
}
if (data.action === 'updateParent') {
const row = findRow(data.id);
if (row === -1) return ok({ success: false, error: 'ID not found' });
// col 4 = parent1, col 5 = parent2
sheet.getRange(row, data.slot === 'parent2' ? 5 : 4).setValue(data.parentId);
return ok({ success: true });
}
if (data.action === 'updatePerson') {
const row = findRow(data.id);
if (row === -1) return ok({ success: false, error: 'ID not found' });
sheet.getRange(row, 2).setValue(data.firstName);
sheet.getRange(row, 3).setValue(data.lastName);
sheet.getRange(row, 7).setValue(data.picture || '');
sheet.getRange(row, 8).setValue(data.comments || '');
return ok({ success: true });
}
if (data.action === 'deletePerson') {
const row = findRow(data.id);
if (row === -1) return ok({ success: false, error: 'ID not found' });
sheet.deleteRow(row);
return ok({ success: true });
}
// Default: append new person row
sheet.appendRow([
data.id, data.firstName, data.lastName,
data.parent1 || '', data.parent2 || '',
data.spouse || '', data.picture || '', data.comments || ''
]);
return ok({ success: true });
} catch (err) {
return ok({ success: false, error: err.toString() });
}
}
function ok(obj) {
return ContentService
.createTextOutput(JSON.stringify(obj))
.setMimeType(ContentService.MimeType.JSON);
}
function doGet(e) {
return ok({ status: 'ok' });
}
Share
👀 Anyone with the link can view
Pick a name from the list.
✏️ People who can edit
Google emails them a link. They open the tree and tap Sign in to edit, using that same email.