In one sentence
Students process data like analysts โ array functions, regex, CSV/HTML and Make Code โ and build a weekly report.
Preparation before the session
Time plan
- 00:00โ00:15 Review: the payment reminders
- 00:15โ00:50 Advanced array functions
- 00:50โ01:15 The Text parser and regex
- 01:15โ01:30 โ Break
- 01:30โ01:50 CSV, HTML and files
- 01:50โ02:15 Make Code: JavaScript and Python
- 02:15โ02:50 Building together: a weekly sales report
- 02:50โ03:00 Summary and practice
Lecture parts and activity type
| Part | Activity type |
|---|---|
| Array functions โ power without modules | Playground |
| The Text parser โ extracting from text | Demo |
| CSV, HTML and files | Demo |
| Make Code โ when functions aren't enough | Demo |
| Weekly KPIs โ what to measure | Explanation |
| Building together: a weekly sales report | Building together |
The 3 messages that must get across
- One function > three modules.
- Regex for a fixed format.
- Make Code when you really need it.
Questions for class discussion
- Which report in your organization is still done manually?
- Who needs to receive it and through which channel?
- When is an automatic report dangerous (wrong numbers without anyone checking)?
Live demo script
Array functions
- Search โ Search Rows without a filter (or by date).
- Aggregator โ Array aggregator, Source: Search Rows, fields: agent, amount, region.
- KPIs โ total={{sum(map(2.array; "amount"))}}, deals={{length(2.array)}}, avg={{round(total/deals)}}, agents={{join(distinct(map(2.array; "agent")); ", ")}}.
- Filtered โ sumCenter={{sum(map(2.array; "amount"; "region"; "Center"))}}.
The Text parser on order emails
- Input โ Tools โ Compose a string with the order text.
- Regex โ Text parser โ Match pattern โ the pattern from the lecture โ Run once.
- Conversions โ amount={{parseNumber(replace(2.amount; ","; emptystring))}}, date={{parseDate(2.date; "DD/MM/YYYY")}}.
- Filter โ order Exists.
An HTML table and a CSV
- Table โ Text aggregator (Source: Search Rows), Text: <tr><td>{{agent}}</td>โฆ</tr>.
- CSV โ CSV โ Create CSV (advanced) โ Source: Search Rows? (or Array aggregator) โ fields.
- BOM โ File data: {{"\uFEFF" + 6.text}} (or the Include BOM option if it exists).
- Gmail โ HTML content with <table>, Attachments: file name sales-week-{{formatDate(now; "W")}}.csv, Data: the CSV.
Problems students will run into
| Problem | Quick fix |
|---|---|
| sum returns an error | Text values with a currency sign or commas โ clean them in the sheet or parseNumber. |
| agents appears as [object] | map on a whole collection โ specify a field. |
| The pattern doesn't match | Typographic quotes/dots vs. plain ones โ use .? instead. |
| amount with a comma | replace before parseNumber. |
| Gmail was sent 30 times | The Text aggregator/CSV isn't set with the right source. |
| The CSV is gibberish in Excel | The BOM is missing. |
| prev = 0 โ division by zero | if(prev = 0; "โ"; โฆ). |
| Make Code: input undefined | Map the array to an input field named rows. |
Tips from the classroom
- map with filtering is a "wow" moment โ spend time on it.
- Not everyone has a paid plan โ show Make Code as a demo.
- Remind them about the midterm exam.
Adapting to different levels
For students who struggle: KPIs with functions only.
For fast students: Top 3 + a yearly comparison.
Answer key โ multiple-choice questions
Students see the answers in shuffled order, so the key gives the wording of the right answer.
| # | Right answer |
|---|---|
| 1 | slice(sort(array; "desc"; "amount"); 0; 3) |
| 2 | A list of agents without duplicates |
| 3 | A fixed, known format |
| 4 | (? |
| 5 | About 2 Credits a second |
| 6 | Outputs a bundle per group |
| 7 | A Text aggregator with |
| 8 | sum() |
Homework
- An active weekly report.
- Preparing for session 8: open free accounts on Airtable and Supabase.
- ๐ The midterm exam (sessions 1โ7) is available on the home page.