Dynamic Multi-Condition Revenue Filter (QUERY + IMPORTRANGE)
Pulls paid customer transactions from another sheet or tab, filters exclusively by date ranges and minimum purchase value, and sorts descending by amount.
=QUERY(
IMPORTRANGE("https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID_HERE", "Orders!A:F"),
"SELECT Col1, Col2, Col4, Col6
WHERE Col4 = 'Completed'
AND Col6 >= 25
AND Col1 >= date '"&TEXT(TODAY()-30, "yyyy-mm-dd")&"'
ORDER BY Col6 DESC
LABEL Col1 'Order Date', Col2 'Customer Name', Col4 'Status', Col6 'Revenue ($)'",
1
)
💡Implementation Tip: Replace YOUR_SHEET_ID_HERE with the URL ID of your master transaction spreadsheet. Grant access once when prompted by Google Sheets.
Automated Low-Stock Reorder Alert (IFS + XLOOKUP)
Calculates whether an inventory SKU requires immediate reordering based on current warehouse quantity, daily sales velocity, and supplier lead days.
=IFS(
B2 <= 0,
"🚨 CRITICAL: Out of Stock",
B2 <= (C2 * D2),
"⚠️ REORDER NOW (" & ((C2 * D2 * 2) - B2) & " units needed)",
B2 <= (C2 * D2 * 1.5),
"⚡ Low Buffer (" & ROUND(B2/C2, 0) & " days remaining)",
TRUE,
"✅ Healthy Stock (" & ROUND(B2/C2, 0) & " days)"
)
💡Implementation Tip: Assumes Cell B2 = Current Stock, Cell C2 = Average Daily Sales, and Cell D2 = Supplier Lead Time in Days. Drag down across all catalog SKUs.
Marketplace Gross Margin & Net Payout Calculator (LET + LAMBDA)
Modular formula that dynamically deducts payment gateway percentage, flat transaction fee, packaging costs, and ad spend to reveal true net profit per order.
=LET(
salePrice, A2,
costOfGoods, B2,
adSpendPerUnit, C2,
gatewayRate, 0.029,
gatewayFlat, 0.30,
marketplaceFeeRate, 0.05,
grossRevenue, salePrice,
gatewayFee, (grossRevenue * gatewayRate) + gatewayFlat,
platformCommission, grossRevenue * marketplaceFeeRate,
totalDeductions, costOfGoods + adSpendPerUnit + gatewayFee + platformCommission,
netProfit, grossRevenue - totalDeductions,
netMargin, netProfit / grossRevenue,
"Net Profit: $" & TEXT(netProfit, "0.00") & " (" & TEXT(netMargin, "0.0%") & " Margin)"
)
💡Implementation Tip: Input Sale Price in A2, COGS in B2, and Ad Spend per Unit in C2. Works natively in modern Excel and Google Sheets without external add-ons.
Smart Lead Phone & Country Code Standardizer (REGEXREPLACE)
Cleans messy, human-entered phone numbers containing brackets, hyphens, and spaces into a clean international WhatsApp and CRM-ready format.
=IF(ISBLANK(A2), "",
LET(
rawDigits, REGEXREPLACE(TO_TEXT(A2), "[^0-9]", ""),
IF(LEFT(rawDigits, 1) = "0",
"+62" & MID(rawDigits, 2, 20),
IF(LEFT(rawDigits, 1) = "8",
"+62" & rawDigits,
"+" & rawDigits
)
)
)
)
💡Implementation Tip: Cell A2 contains the raw phone input (e.g. "0812-3456-7890" or "(0812) 34567890"). Adjust the "+62" prefix if your target country is outside Indonesia.
Rolling Monthly Customer Retention & Churn Rate (SUMIFS)
Computes active subscriber retention percentage for any given billing cycle against the original cohort signup count.
=LET(
cohortSignups, COUNTIFS(Subscriptions!$B:$B, B$1, Subscriptions!$C:$C, "<="&EOMONTH($A2, -1)),
retainedActive, COUNTIFS(Subscriptions!$B:$B, B$1, Subscriptions!$D:$D, ">="&$A2, Subscriptions!$C:$C, "<="&$A2),
IF(cohortSignups = 0, "-", TEXT(retainedActive / cohortSignups, "0.0%"))
)
💡Implementation Tip: Row 1 contains Cohort Months, Column A contains Rolling Reporting Months. Table dynamically outputs retention curve percentages.
Customer Support Sentiment & Urgent Ticket Triage Engine
Analyzes inbound customer support emails, calculates frustration levels, detects refund/chargeback risks, and generates an empathetic resolution draft.
You are an empathetic, highly efficient Customer Support Operations Lead.
OBJECTIVE:
Evaluate the incoming customer support message, assess sentiment urgency, and generate an immediate resolution draft.
RULES:
1. Detect churn or chargeback risk (HIGH, MEDIUM, LOW).
2. Never apologize defensively; offer proactive accountability and clear next steps.
3. Keep the drafted response under 150 words.
OUTPUT FORMAT (Strict JSON):
{
"urgency_level": "CRITICAL" | "HIGH" | "NORMAL",
"churn_risk": "HIGH" | "MEDIUM" | "LOW",
"detected_pain_point": "Short summary of the core friction",
"recommended_action": "e.g. Issue immediate refund / Reset API key / Escalate to billing",
"empathetic_draft_reply": "Hi [Customer Name],\n\n[Empathetic opening acknowledging their exact frustration].\n\n[Clear actionable resolution or timeline].\n\nBest regards,\nSupport Team"
}
💡Implementation Tip: Paste this prompt into your OpenAI API, Make.com webhook, or Claude project instructions for automated inbound email routing.
High-Converting B2B Cold Outreach Personalizer
Ingests a prospect’s LinkedIn summary or company landing page and extracts 2 concrete operational bottlenecks into a concise, non-pushy 3-sentence pitch.
TASK:
Write a high-converting, non-spammy 3-sentence cold email tailored to the prospect data below.
PROSPECT INPUT:
Name: {{Prospect_Name}}
Company: {{Company_Name}}
Website / Bio: {{Company_Summary_Or_Bio}}
Our Solution: {{Our_Product_Or_Service}}
STRICT EDITORIAL CONSTRAINTS:
1. Sentence 1: Specific observation proving you actually researched their business (NO generic flattery like "I love your work!").
2. Sentence 2: Connect their probable operational bottleneck to our tangible result (include numbers or time saved).
3. Sentence 3: Low-friction soft Call to Action (e.g. "Worth exploring for 5 minutes next Tuesday, or are you covered?").
4. Under 65 words total. Zero corporate buzzwords ("synergy", "game-changer", "revolutionary").
OUTPUT:
Subject Line: {{Subject}}
Body:
{{Body}}
💡Implementation Tip: Combine with Google Sheets and Make.com / Zapier to generate personalized cold outreach columns in bulk.
E-Commerce Tech Specs to Benefit-Driven Sales Bullets
Converts dry, technical product specifications into persuasive, emotion-triggering benefit bullet points optimized for Amazon, Shopify, or landing pages.
You are an elite Direct-Response E-Commerce Copywriter.
TASK:
Transform dry manufacturer specifications into 5 high-converting, benefit-driven product bullets for an e-commerce product page.
FRAMEWORK TO APPLY:
Feature + Practical Benefit + Emotional Relief.
(Example: "Made of 304 Stainless Steel" -> "Rust-Proof 304 Stainless Steel: Withstands daily dishwasher cycles without tarnishing, so you never have to scrub stubborn water stains by hand.")
INPUT PRODUCT DATA:
Product: {{Product_Title}}
Raw Specs: {{Raw_Manufacturer_Specs}}
Target Audience: {{Target_Shopper}}
OUTPUT GUIDELINE:
- 5 concise bullet points.
- Begin each bullet with a bold 2-3 word anchor phrase.
- Focus on how the product simplifies the buyer's daily routine.
💡Implementation Tip: Ideal for dropshippers, Amazon sellers, and Shopify store owners writing product catalogs at scale.
Unstructured Invoice & Receipt Data Extractor (Zero-Slop JSON)
Instructs LLMs to reliably parse messy receipt OCR or email text into standardized financial accounting fields without conversational fluff.
You are an automated accounting parser.
Extract all transactional details from the raw invoice/receipt text below. Output ONLY a valid JSON object matching the schema. Do not write markdown code fences or conversational text.
RAW INVOICE TEXT:
{{Raw_Invoice_Text}}
STRICT JSON SCHEMA:
{
"vendor_name": string,
"invoice_number": string | null,
"transaction_date": "YYYY-MM-DD",
"currency": "USD" | "IDR" | "EUR" | "GBP",
"subtotal": number,
"tax_amount": number,
"total_amount": number,
"line_items": [
{
"description": string,
"quantity": number,
"unit_price": number,
"total": number
}
],
"payment_method": string | null
}
💡Implementation Tip: Enforce response_format: { type: "json_object" } in OpenAI or response_mime_type: "application/json" in Gemini Flash.
Long-Form Article to Insight-Dense Social Media Thread
Condenses a 1,500-word blog post or newsletter into a 5-tweet educational thread or LinkedIn carousel script without superficial hype.
You are a Ghostwriter for high-credibility founders and technical operators.
TASK:
Repurpose the core insights of this long-form article into a 5-part LinkedIn / X micro-guide.
CONSTRAINTS:
1. Post 1 (Hook): State the counter-intuitive finding or operational lesson in under 25 words. No clickbait or question spam.
2. Posts 2-4: Concrete playbooks or frameworks explaining HOW to solve the problem (use bullet points and exact metrics).
3. Post 5 (Takeaway): 1 actionable rule the reader can execute in under 15 minutes today.
4. Total tone: Pragmatic, humble, and evidence-based. No rocketship emojis (🚀) or fake motivational drama.
ARTICLE INPUT:
{{Article_Text}}
💡Implementation Tip: Feed your latest published articles into this prompt to keep your LinkedIn or X feed active with high-signal content.
Google Apps Script Webhook to Google Sheets Logger
Free, serverless webhook receiver that captures incoming order/lead notifications from Lynk, Stripe, Gumroad, or Shopify and appends rows instantly.
function doPost(e) {
var lock = LockService.getScriptLock();
lock.tryLock(10000); // Prevent concurrent write race conditions
try {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var payload = JSON.parse(e.postData.contents);
var timestamp = new Date().toISOString();
var eventType = payload.event || payload.type || 'order_created';
var customerEmail = payload.email || (payload.data && payload.data.email) || 'N/A';
var customerName = payload.name || (payload.data && payload.data.name) || 'N/A';
var amount = payload.amount || (payload.data && payload.data.amount) || 0;
var rawDetails = JSON.stringify(payload);
sheet.appendRow([timestamp, eventType, customerName, customerEmail, amount, rawDetails]);
return ContentService
.createTextOutput(JSON.stringify({ status: 'success', recorded_at: timestamp }))
.setMimeType(ContentService.MimeType.JSON);
} catch (error) {
return ContentService
.createTextOutput(JSON.stringify({ status: 'error', message: error.toString() }))
.setMimeType(ContentService.MimeType.JSON);
} finally {
lock.releaseLock();
}
}
💡Implementation Tip: In Google Sheets: Extensions -> Apps Script -> Paste code -> Deploy -> New Deployment -> Web App -> Execute as Me -> Anyone has access.
Instant Telegram Lead Alert Bot via Google Apps Script
Pushes real-time alerts to your smartphone via Telegram the exact second a client submits a form, downloads a freebie, or completes checkout.
function sendTelegramLeadAlert(leadName, leadEmail, source, note) {
var botToken = "YOUR_TELEGRAM_BOT_TOKEN_HERE"; // From @BotFather
var chatId = "YOUR_TELEGRAM_CHAT_ID_HERE"; // Your personal or group chat ID
var message = "🔔 *New Inbound Lead Received!*\n\n"
+ "👤 *Name:* " + leadName + "\n"
+ "📧 *Email:* " + leadEmail + "\n"
+ "🎯 *Source:* " + source + "\n"
+ "📝 *Note:* " + (note || "None") + "\n\n"
+ "⏱️ _Time: " + Utilities.formatDate(new Date(), "GMT+7", "yyyy-MM-dd HH:mm:ss") + " WIB_";
var url = "https://api.telegram.org/bot" + botToken + "/sendMessage";
var payload = {
chat_id: chatId,
text: message,
parse_mode: "Markdown"
};
UrlFetchApp.fetch(url, {
method: "post",
contentType: "application/json",
payload: JSON.stringify(payload),
muteHttpExceptions: true
});
}
💡Implementation Tip: Create a free bot via @BotFather on Telegram, paste the token, and call this function whenever a new lead row is added.
Automated PDF Invoice Compiler & Email Dispatcher
Duplicates a master Google Doc invoice template, injects customer billing data, compiles a high-res PDF, and emails it automatically.
function generateAndEmailInvoice(customerEmail, customerName, invoiceNumber, amountUsd) {
var templateDocId = "YOUR_GOOGLE_DOC_TEMPLATE_ID";
var outputFolderId = "YOUR_GOOGLE_DRIVE_FOLDER_ID";
// Duplicate template and substitute variables
var copy = DriveApp.getFileById(templateDocId).makeCopy("Invoice_" + invoiceNumber, DriveApp.getFolderById(outputFolderId));
var doc = DocumentApp.openById(copy.getId());
var body = doc.getBody();
body.replaceText("{{CUSTOMER_NAME}}", customerName);
body.replaceText("{{INVOICE_NO}}", invoiceNumber);
body.replaceText("{{AMOUNT}}", "$" + amountUsd.toFixed(2));
body.replaceText("{{DATE}}", Utilities.formatDate(new Date(), "UTC", "yyyy-MM-dd"));
doc.saveAndClose();
// Export to PDF and send via Gmail
var pdfBlob = copy.getAs("application/pdf").setName("Invoice_" + invoiceNumber + ".pdf");
MailApp.sendEmail({
to: customerEmail,
subject: "Official Invoice #" + invoiceNumber + " | ScriptCuan",
body: "Hi " + customerName + ",\n\nThank you for your business. Please find your official invoice attached.\n\nBest regards,\nFinance Desk",
attachments: [pdfBlob]
});
}
💡Implementation Tip: Create a Google Doc formatted with {{CUSTOMER_NAME}}, {{INVOICE_NO}}, {{AMOUNT}} placeholders. Perfect for solopreneur billing.
Daily MRR & Net Subscriber Churn Query (SQLite & D1)
High-performance SQL query calculating active Monthly Recurring Revenue (MRR), new subscriber growth, and churn rate across any date interval.
-- Aggregate monthly active recurring revenue and churn metrics
SELECT
strftime('%Y-%m', date(created_at, 'unixepoch')) AS billing_month,
COUNT(DISTINCT user_id) AS total_active_accounts,
SUM(CASE WHEN status = 'active' THEN amount_cents ELSE 0 END) / 100.0 AS mrr_usd,
SUM(CASE WHEN status = 'canceled' THEN 1 ELSE 0 END) AS canceled_subscribers,
ROUND(
(SUM(CASE WHEN status = 'canceled' THEN 1.0 ELSE 0.0 END) / COUNT(DISTINCT user_id)) * 100.0,
2
) AS churn_percentage
FROM subscriptions
WHERE created_at >= strftime('%s', 'now', '-6 months')
GROUP BY billing_month
ORDER BY billing_month DESC;
💡Implementation Tip: Requires index on subscriptions(created_at, status). Compatible with Cloudflare D1, Turso, Supabase, and SQLite.
Product Sales Volume & Average Order Value (AOV) Breakdown
Groups e-commerce sales by SKU to reveal total transaction volume, aggregate gross revenue, and Average Order Value (AOV).
-- High-performance sales and Average Order Value breakdown
SELECT
product_id,
product_title,
COUNT(id) AS total_orders_count,
SUM(quantity) AS units_sold,
ROUND(SUM(total_price), 2) AS total_gross_revenue,
ROUND(AVG(total_price), 2) AS average_order_value_aov,
ROUND(SUM(discount_amount), 2) AS total_discounts_absorbed
FROM order_items
WHERE status = 'paid'
GROUP BY product_id, product_title
ORDER BY total_gross_revenue DESC
LIMIT 20;
💡Implementation Tip: Helps identify your 80/20 top-earning catalog items so you can focus ad spend on proven converters.