Last week create_doc made a blank document. This week we stop writing to single apps and start connecting them. One function — read a Sheet, format a summary, send it as an email. What would you reach for first?
I'd start with the Sheet read — same as read_range from Day 17. Get the data into Python. Then format it. Then hand it to send_email.
Exactly the right order. GOOGLESHEETS_BATCH_GET comes first — spreadsheet_id and a ranges list. The response nests your rows inside valueRanges[0]["values"]. Here's the pull:
sheet_result = toolset.execute_action(Action.GOOGLESHEETS_BATCH_GET, {
"spreadsheet_id": sheet_id,
"ranges": ["A1:D10"],
})
values = sheet_result.get("valueRanges", [{}])[0].get("values", [])So I have a 2D list of rows. How do I turn that into an email body? Each row is ["Paid search", "12400", ...] — I need to collapse it to text.
One list comprehension. Filter rows that have at least two columns, join the first two as "metric: value", then join the lines with newlines:
summary_lines = [f"{row[0]}: {row[1]}" for row in values if len(row) >= 2]
body = "\n".join(summary_lines) if summary_lines else "No data."
print(f"{len(summary_lines)} lines ready to send")And then I just call GMAIL_SEND_EMAIL with that body string? The whole Sheet-to-inbox pipeline is maybe ten lines?
Ten lines. That's Monday morning — KPI digest drafted, formatted, delivered — while you're still on your first coffee. The send step uses recipient_email, not to — the same Composio key that tripped you in Day 7:
I could wire my whole Monday morning in this. Pull the Sheet, format the summary, email it to myself, create the Calendar event for the QBR review — one function call. I'm actually going to do this.
That's exactly where Week 4 lands. Always send to yourself first while you're testing. In a real workflow you'd confirm the recipient and preview the body before the send fires — never skip that gate when the list gets longer than one.
email_sheet_summary is a two-action pipeline: read rows with GOOGLESHEETS_BATCH_GET, build a plain-text digest, then deliver it with GMAIL_SEND_EMAIL.
sheet_result["valueRanges"][0]["values"] → [["metric", "value"], ...]
Use double .get() so an empty sheet returns [] instead of a KeyError.
Filter rows with len(row) >= 2 to skip blank rows, then join with "\n". Fall back to "No data." when the sheet is empty — never send a blank email.
Always send to yourself during development. In production, preview the body string and confirm the recipient before calling GMAIL_SEND_EMAIL.
Last week create_doc made a blank document. This week we stop writing to single apps and start connecting them. One function — read a Sheet, format a summary, send it as an email. What would you reach for first?
I'd start with the Sheet read — same as read_range from Day 17. Get the data into Python. Then format it. Then hand it to send_email.
Exactly the right order. GOOGLESHEETS_BATCH_GET comes first — spreadsheet_id and a ranges list. The response nests your rows inside valueRanges[0]["values"]. Here's the pull:
sheet_result = toolset.execute_action(Action.GOOGLESHEETS_BATCH_GET, {
"spreadsheet_id": sheet_id,
"ranges": ["A1:D10"],
})
values = sheet_result.get("valueRanges", [{}])[0].get("values", [])So I have a 2D list of rows. How do I turn that into an email body? Each row is ["Paid search", "12400", ...] — I need to collapse it to text.
One list comprehension. Filter rows that have at least two columns, join the first two as "metric: value", then join the lines with newlines:
summary_lines = [f"{row[0]}: {row[1]}" for row in values if len(row) >= 2]
body = "\n".join(summary_lines) if summary_lines else "No data."
print(f"{len(summary_lines)} lines ready to send")And then I just call GMAIL_SEND_EMAIL with that body string? The whole Sheet-to-inbox pipeline is maybe ten lines?
Ten lines. That's Monday morning — KPI digest drafted, formatted, delivered — while you're still on your first coffee. The send step uses recipient_email, not to — the same Composio key that tripped you in Day 7:
I could wire my whole Monday morning in this. Pull the Sheet, format the summary, email it to myself, create the Calendar event for the QBR review — one function call. I'm actually going to do this.
That's exactly where Week 4 lands. Always send to yourself first while you're testing. In a real workflow you'd confirm the recipient and preview the body before the send fires — never skip that gate when the list gets longer than one.
email_sheet_summary is a two-action pipeline: read rows with GOOGLESHEETS_BATCH_GET, build a plain-text digest, then deliver it with GMAIL_SEND_EMAIL.
sheet_result["valueRanges"][0]["values"] → [["metric", "value"], ...]
Use double .get() so an empty sheet returns [] instead of a KeyError.
Filter rows with len(row) >= 2 to skip blank rows, then join with "\n". Fall back to "No data." when the sheet is empty — never send a blank email.
Always send to yourself during development. In production, preview the body string and confirm the recipient before calling GMAIL_SEND_EMAIL.
Create a free account to get started. Paid plans unlock all tracks.