Pega tu URL de Apps Script y haz clic en conectar
1. Pégalo en Code.gs • 2. Ejecuta "autorizarEscritura" con el botón Run • 3. Ve a Deploy > New deployment (Web app / Anyone)
function doGet(e) {
const hoja = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Si desde el HTML mandamos una fila para actualizar el TikTok Lead Status (Columna B = 2)
if (e && e.parameter && e.parameter.fila) {
const fila = Number(e.parameter.fila);
const estado = e.parameter.estado || "";
hoja.getRange(fila, 2).setValue(estado);
SpreadsheetApp.flush();
}
const datos = hoja.getDataRange().getDisplayValues();
const usuario = Session.getEffectiveUser().getEmail() || "Cuenta Google Conectada";
const filas = datos.length > 1 ? datos.slice(1) : [];
return ContentService.createTextOutput(JSON.stringify({
usuario: usuario,
contactos: filas
})).setMimeType(ContentService.MimeType.JSON);
}
// Ejecuta esta función una vez con el botón "Run" para dar permiso de escritura
function autorizarEscritura() {
const hoja = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
hoja.getRange(2, 2).setValue(hoja.getRange(2, 2).getValue());
}
| # | TikTok Lead ID (Col A) | TikTok Lead Status (Col B) | Correo (Col C) | Teléfono / WhatsApp (Col D) | Clic (Col E) |
|---|---|---|---|---|---|
| Presiona "Conectar cuenta y Hoja" para empezar a escuchar nuevos contactos... | |||||