[object Object]

← back to Rentv Sheet Enrich

Layer 1 complete: collision-proof column placement (live-detected), 1282 websites filled green across 3 revenue tabs; reset+re-mapped Strong Prospects/Event Sponsors

9d158db2c1287b69921a01b6c7f7692bd8a88da8 · 2026-08-13 09:29:34 -0700 · Steve Abrams

Files touched

Diff

commit 9d158db2c1287b69921a01b6c7f7692bd8a88da8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Aug 13 09:29:34 2026 -0700

    Layer 1 complete: collision-proof column placement (live-detected), 1282 websites filled green across 3 revenue tabs; reset+re-mapped Strong Prospects/Event Sponsors
---
 __pycache__/enrich.cpython-314.pyc | Bin 0 -> 7659 bytes
 __pycache__/lib.cpython-314.pyc    | Bin 6414 -> 7161 bytes
 enrich.py                          |  28 +++++++++++++++-------------
 lib.py                             |  22 ++++++++++++++++------
 4 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/__pycache__/enrich.cpython-314.pyc b/__pycache__/enrich.cpython-314.pyc
new file mode 100644
index 0000000..552328a
Binary files /dev/null and b/__pycache__/enrich.cpython-314.pyc differ
diff --git a/__pycache__/lib.cpython-314.pyc b/__pycache__/lib.cpython-314.pyc
index a5b414e..2c45a28 100644
Binary files a/__pycache__/lib.cpython-314.pyc and b/__pycache__/lib.cpython-314.pyc differ
diff --git a/enrich.py b/enrich.py
index 9199d38..01d7dd1 100644
--- a/enrich.py
+++ b/enrich.py
@@ -28,20 +28,22 @@ FREEMAIL = {"gmail.com","hotmail.com","yahoo.com","outlook.com","aol.com","iclou
 #   data_start : first data row (0-based)
 #   company/email : source column indices
 #   new_website/new_linkedin/new_mvp : destination column indices for the added set
+# base = first column of the 4-col added block, chosen to sit AFTER each tab's true
+# max-used column (verified against the LIVE read, NOT the misleading CSV export).
 TABS = {
     1536880271: dict(name="Sponsor & Speaker Companies",
-        header_row=0, data_start=2, company=2, email=6,
-        new_website=10, new_li_company=11, new_li_contact=12, new_mvp=13),
+        header_row=0, data_start=2, company=2, email=6, base=10),   # K-N
     2087021739: dict(name="Strong Prospects",
-        header_row=0, data_start=1, company=3, email=7,
-        new_website=9, new_li_company=10, new_li_contact=11, new_mvp=12),
+        header_row=1, data_start=2, company=3, email=7, base=11),   # L-O (skips K status col)
     1929460437: dict(name="Event Sponsors",
-        header_row=0, data_start=1, company=2, email=6,
-        new_website=8, new_li_company=9, new_li_contact=10, new_mvp=11),
+        header_row=1, data_start=2, company=2, email=6, base=9),    # J-M (after I status col)
 }
 
-NEW_COLS = [("new_website","Website"), ("new_li_company","LinkedIn (Company)"),
-            ("new_li_contact","LinkedIn (Contact)"), ("new_mvp","Marketing/VP Contact")]
+NEW_LABELS = ["Website", "LinkedIn (Company)", "LinkedIn (Contact)", "Marketing/VP Contact"]
+
+def cols(cfg):
+    b = cfg["base"]
+    return dict(new_website=b, new_li_company=b+1, new_li_contact=b+2, new_mvp=b+3)
 
 def cell(row, i):
     return row[i].strip() if i < len(row) else ""
@@ -56,13 +58,13 @@ def domain_from_emails(emailcell):
 
 def plan_tab(gid, rows):
     """Return (fills, stats). fills = list of {row0,col0,value}."""
-    cfg = TABS[gid]
+    cfg = TABS[gid]; nc = cols(cfg)
     fills, stats = [], dict(rows=0, has_email=0, website_fill=0, freemail_only=0, no_email=0)
     # header cells for the new columns (only if currently blank)
     hr = cfg["header_row"]
     hdr = rows[hr] if hr < len(rows) else []
-    for key, label in NEW_COLS:
-        col = cfg[key]
+    for i, label in enumerate(NEW_LABELS):
+        col = cfg["base"] + i
         if cell(hdr, col) == "":
             fills.append({"row0": hr, "col0": col, "value": label})
     for r in range(cfg["data_start"], len(rows)):
@@ -73,12 +75,12 @@ def plan_tab(gid, rows):
         stats["rows"] += 1
         emailc = cell(row, cfg["email"])
         # only fill Website if that new cell is currently empty
-        if cell(row, cfg["new_website"]) != "":
+        if cell(row, nc["new_website"]) != "":
             continue
         dom = domain_from_emails(emailc)
         if dom:
             stats["has_email"] += 1; stats["website_fill"] += 1
-            fills.append({"row0": r, "col0": cfg["new_website"], "value": dom})
+            fills.append({"row0": r, "col0": nc["new_website"], "value": dom})
         elif emailc:
             stats["freemail_only"] += 1   # has email but only free-mail -> needs Layer 2
         else:
diff --git a/lib.py b/lib.py
index 9f5495d..31b3114 100644
--- a/lib.py
+++ b/lib.py
@@ -79,10 +79,20 @@ def batch_fill(tok, sheet_id, cells):
             "fields": "userEnteredValue,userEnteredFormat.backgroundColor"}}
     if not cells:
         return {"skipped": True}
-    total = 0
-    CHUNK = 400
-    for i in range(0, len(cells), CHUNK):
-        reqs = [mk(c) for c in cells[i:i+CHUNK]]
-        res = _req("POST", f"{API}/{SID}:batchUpdate", tok, {"requests": reqs})
-        total += len(reqs)
+    return _chunked(tok, sheet_id, [mk(c) for c in cells])
+
+def clear_cells(tok, sheet_id, coords):
+    """coords: list of (row0,col0) — blank the value AND reset background to white."""
+    reqs = [{"updateCells": {
+        "start": {"sheetId": sheet_id, "rowIndex": r, "columnIndex": c},
+        "rows": [{"values": [{"userEnteredValue": None,
+            "userEnteredFormat": {"backgroundColor": {"red":1,"green":1,"blue":1}}}]}],
+        "fields": "userEnteredValue,userEnteredFormat.backgroundColor"}} for r, c in coords]
+    return _chunked(tok, sheet_id, reqs)
+
+def _chunked(tok, sheet_id, reqs):
+    CHUNK, total = 400, 0
+    for i in range(0, len(reqs), CHUNK):
+        _req("POST", f"{API}/{SID}:batchUpdate", tok, {"requests": reqs[i:i+CHUNK]})
+        total += len(reqs[i:i+CHUNK])
     return {"totalUpdatedCells": total}

← 3661344 Layer 1 LIVE: websites + 4 new cols (Website/LinkedIn Co/Lin  ·  back to Rentv Sheet Enrich  ·  Layer 2 sample (12 cos): LinkedIn company/contact hyperlinks 3315bbc →