Skip to content

Commit 7eaeb6d

Browse files
Update 12. Link Google Sheets.md
changed expression added steps and more explaintion
1 parent fef017f commit 7eaeb6d

File tree

1 file changed

+68
-20
lines changed

1 file changed

+68
-20
lines changed

docs/4. Product Features/03. Flows/2. Flow Actions/12. Link Google Sheets.md

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1-
> ### **10 minutes read                                                                                                                         `Intermediate`**
1+
<h3>
2+
<table>
3+
<tr>
4+
<td><b>10 minutes read</b></td>
5+
<td style={{ paddingLeft: '40px' }}><b>Level:Intermediate</b></td>
6+
<td style={{ paddingLeft: '40px' }}><b>Last Updated: October 2025</b></td>
7+
</tr>
8+
</table>
9+
</h3>
210

3-
___
11+
**The Link Google Sheets action allows you to connect your flows in Glific directly to Google Sheets so you can read, write, and update data in real time.**
412

5-
## Video Tutorial
13+
### When to use Read from Google Sheet
614

15+
**Use this when you need to:**
716

8-
<iframe width="800" height="500" src="https://www.youtube.com/embed/tdFPJg1aLXU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
17+
- Send reminders, schedules, or event details stored in a central sheet.
918

19+
- Populate lists or menus dynamically from sheet data.
20+
21+
### How to set it Google Sheet
22+
23+
- Google Sheets API is linked with Glific.
24+
25+
- The service account has Viewer or Editor access to the sheet.
26+
27+
- The sheet is shared with the service account email.
1028

11-
_Please note: Glific has a new UI, so the visuals from the video will not match the present UI, but the functionality and buttons will remain the same_
12-
___
1329

1430
## Add Readable Google Sheet
1531

@@ -43,19 +59,41 @@ ___
4359
<img width="1298" alt="Screenshot 2024-02-29 at 1 42 44 PM" src="https://github.com/glific/docs/assets/141305477/1a1d5fcf-5d18-4ffe-bfa8-22f0ffabc5d3" />
4460

4561
- `It is important to note that the first cell in the Sheet should be named as 'Key' for the Read function to work.`
46-
___
62+
63+
64+
**Examples**
65+
66+
- Daily Reminders: Match today’s date to a schedule column and send the corresponding message.
67+
68+
- User Lookup: Pull registration details based on phone number or ID.
69+
70+
- Dynamic Menu: Read items from a sheet and send them as interactive list options.
71+
72+
73+
### Why to use Write Mode of Google Sheet
74+
75+
Write Mode lets you send data from WhatsApp conversations directly into Google Sheets, removing the need for manual entry and ensuring immediate updates.
76+
77+
### When to use Write Mode
78+
79+
- Use this when you need to:
80+
- Record survey answers in real time.
81+
- Collect event registrations or sign-ups
82+
- Track responses, feedback, or status updates.
83+
84+
4785

4886
## Configuring Readable Google Sheet in the Flow
4987

50-
9 . Create a new flow and open it for editing
88+
1 . Create a new flow and open it for editing
5189

52-
10. Use `link Google sheet` node
90+
2. Use `link Google sheet` node
5391

54-
1. Select `Link google Sheet`
92+
3. Select `Link google Sheet`
5593

56-
2. In the second drop-down select the sheet
94+
4. In the second drop-down select the sheet
5795

58-
3. In `Select row` add any variable that uniquely defines the `Key` column of the linked Google sheet
96+
5. In `Select row` add any variable that uniquely defines the `Key` column of the linked Google sheet
5997

6098
<img width="505" alt="Screenshot 2024-02-29 at 1 47 48 PM" src="https://github.com/glific/docs/assets/141305477/f15cce2a-7882-4f83-901e-48b7d7bba09d" />
6199

@@ -68,13 +106,23 @@ These all are the below calendar functions that can be used :
68106
To write date and time, use the following expression:
69107
`<%= DateTime.now!("Asia/Kolkata") |> Calendar.strftime("%Y/%m/%d %H:%M:%S") %>`
70108

71-
4. Click on `OK`
109+
6. Click on `OK`
72110

73-
5. Use column header like below and access the relevant column of the identified row.
111+
7. Use column header like below and access the relevant column of the identified row.
74112

75113
`@results.sheet.col_nameA`
76114

77115
![image](https://user-images.githubusercontent.com/32592458/219550825-82831f46-a239-4600-b95e-bf0533f0565b.png)
116+
117+
118+
**Examples**
119+
120+
- Survey Submission: Write answers to a new row for each participant.
121+
- Registration Forms: Save participant name, contact number, and event preferences.
122+
- Attendance Logs: Record check-ins directly into the sheet.
123+
124+
125+
78126
___
79127

80128
## Send template messages using Google Sheets
@@ -96,9 +144,9 @@ Let us dive in a bit deeper by looking at the steps involved :
96144

97145
As you can see, the row input field is given an expression `@calendar.current_date` which tries to match the current date value with a `Key` value. If a match is found, then that row is chosen.
98146

99-
5. In the next step, `Send contact a message` is used and an expression is given in place of the template selection drop-down. The expression reads `<%= Glific.send_template("{uuid}", ["{variables}"]) %>`
147+
5. In the next step, `Send contact a message` is used and an expression is given in place of the template selection drop-down. The expression reads <%= `Glific.send_template("@results.sheet.template_uuid", ["@contact.name"] ) %>` and if no variables then `<%= Glific.send_template("@results.sheet.template_uuid", [] ) %>`
100148

101-
![Screenshot 2023-09-15 at 1 56 54 PM](https://user-images.githubusercontent.com/132430123/268223071-9f2730b9-9364-46fc-b062-1bbd39c102f9.png)
149+
102150

103151
In this expression, the `template_uuid` matching the row in the given date gets send to the user. The expression also passes the value of the contact's name. You can pass multiple variables in this expression, if the template message demands it, using comma separation.
104152

@@ -121,18 +169,18 @@ Let's dive in a bit deeper to see how it works.
121169

122170
<img width="1294" alt="Screenshot 2024-02-29 at 2 08 50 PM" src="https://github.com/glific/docs/assets/141305477/e5c8b2b4-c33f-4360-9f6d-ff14a76c12f3"/>
123171

124-
3. Now since we have the Google Sheets linked & the interactive message created, let's create a sample flow to understand how it works :
172+
4. Now since we have the Google Sheets linked & the interactive message created, let's create a sample flow to understand how it works :
125173
<img width="738" alt="Screenshot 2023-09-19 at 11 51 38 AM" src="https://user-images.githubusercontent.com/132430123/268859289-c3af33c5-8bc2-4eb0-96ff-d2d8aa4cba01.png"/>
126174

127-
4. As you can see, the flow starts with a Link Google Sheets node, where the readable google sheets from which the options to be fetched inside the interactive message is added. This is how the Google Sheets node is configured :
175+
5. As you can see, the flow starts with a Link Google Sheets node, where the readable google sheets from which the options to be fetched inside the interactive message is added. This is how the Google Sheets node is configured :
128176
<img width="628" alt="Screenshot 2023-09-19 at 11 53 27 AM" src="https://user-images.githubusercontent.com/132430123/268859658-2780aa59-e56c-4b7d-aecf-9b55ff47496e.png"/>
129177

130178
- In the node above, the sheet we created have been linked & the corresponding action is marked as `Read` since the options for `Interactive Message` are being read from the Google Sheets.
131179
- Here 1 is added in `Select row` field, as the values for the interactive message are present on the row with the key value as 1 and it is stored under the variable name `sheet`
132180
- Instead of 1, you can also use dynamic values like [flow variables or contact variables](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Variables/Flow%20variables%20vs%20Contact%20variables), functions like @calendar.current_date etc.
133181

134182

135-
5. The next node consists of `Send contact an interactive message` node and this is how it is configured
183+
6. The next node consists of `Send contact an interactive message` node and this is how it is configured
136184
<img width="611" alt="Screenshot 2023-09-19 at 2 14 22 PM" src="https://user-images.githubusercontent.com/132430123/268894962-90c136b4-3775-426d-9962-269e7407feba.png"/>
137185

138186
- The interactive message we've created is chosen from the dropdown.
@@ -141,7 +189,7 @@ Let's dive in a bit deeper to see how it works.
141189
- The `id` and `variable` values need to be filled. The id could be any unique value for referencing & variable value is being fetched from the linked Google Sheet.
142190
- The variable names are filled as `@results.sheet.course1`, `@results.sheet.course2` and so on representing each row value from the row we've chosen to read from.
143191

144-
6. Now since the flow is configured, let's test the flow
192+
7. Now since the flow is configured, let's test the flow
145193
<img width="286" alt="Screenshot 2023-09-19 at 12 07 16 PM" src="https://user-images.githubusercontent.com/132430123/268862637-8919962e-840e-47dd-9865-919dd902b483.png"/>
146194

147195
As you can see on the preview above, the list of options we had given in the Google Sheets are shown as a list of options inside the Interactive Message.

0 commit comments

Comments
 (0)