Skip to content

Commit ac8bb2c

Browse files
authored
Merge pull request #423 from glific/Link-to-the-Google-Sheets.md
Update 12. Link Google Sheets.md
2 parents 6a63cc2 + 3d6fefc commit ac8bb2c

File tree

1 file changed

+74
-27
lines changed

1 file changed

+74
-27
lines changed

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

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,51 @@
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 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

16-
1 . Log in to your Glific account.
32+
1. Log in to your Glific account.
1733

18-
2 . Click on `Flows` from the left panel and find `Google sheets`
34+
2. Click on `Flows` from the left panel and find `Google sheets`
1935

20-
4 . Click on `+Create` button to add a sheet to read from
36+
3. Click on `+Create` button to add a sheet to read from
2137

2238
<img width="1468" alt="Screenshot 2024-02-29 at 1 35 52 PM" src="https://github.com/glific/docs/assets/141305477/d0605089-b71e-41ba-85c2-593dabf49b40" />
2339

24-
25-
5 . Add the `Sheet URL` and `Name` of the sheet which you want to integrate. Check the `Read` checkbox and Click on the`Save` button. Follow next steps to get the URL
40+
4. Add the `Sheet URL` and `Name` of the sheet which you want to integrate. Check the `Read` checkbox and Click on the`Save` button. Follow next steps to get the URL
2641

2742
<img width="413" alt="Screenshot 2024-02-29 at 1 38 46 PM" src="https://github.com/glific/docs/assets/141305477/2612f184-eb99-4e02-aca9-6b4c1adbec16"/>
2843

29-
6. Open the Google sheet and click on share button on the right hand side to update the sheet permission to at least `Anyone with the link` can `View`
44+
5. Open the Google sheet and click on share button on the right hand side to update the sheet permission to at least `Anyone with the link` can `View`
3045

3146
![image](https://user-images.githubusercontent.com/32592458/219550695-58224a6f-4312-4981-b518-1dd6de639e3a.png)
3247

33-
6 . Copy the URL
48+
6. Copy the URL
3449

3550
![image](https://user-images.githubusercontent.com/32592458/219550711-8471dcf3-974c-459d-a486-b77b841742d0.png)
3651

@@ -43,19 +58,41 @@ ___
4358
<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" />
4459

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

4885
## Configuring Readable Google Sheet in the Flow
4986

50-
9 . Create a new flow and open it for editing
87+
1 . Create a new flow and open it for editing
5188

52-
10. Use `link Google sheet` node
89+
2. Use `link Google sheet` node
5390

54-
1. Select `Link google Sheet`
91+
3. Select `Link google Sheet`
5592

56-
2. In the second drop-down select the sheet
93+
4. In the second drop-down select the sheet
5794

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

6097
<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" />
6198

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

71-
4. Click on `OK`
108+
6. Click on `OK`
72109

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

75112
`@results.sheet.col_nameA`
76113

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

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

97144
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.
98145

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}"]) %>`
146+
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", [] ) %>`
100147

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

103150
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.
104151

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

122169
<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"/>
123170

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 :
171+
4. Now since we have the Google Sheets linked & the interactive message created, let's create a sample flow to understand how it works :
125172
<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"/>
126173

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 :
174+
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 :
128175
<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"/>
129176

130177
- 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.
131178
- 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`
132179
- 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.
133180

134181

135-
5. The next node consists of `Send contact an interactive message` node and this is how it is configured
182+
6. The next node consists of `Send contact an interactive message` node and this is how it is configured
136183
<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"/>
137184

138185
- The interactive message we've created is chosen from the dropdown.
@@ -141,7 +188,7 @@ Let's dive in a bit deeper to see how it works.
141188
- 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.
142189
- 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.
143190

144-
6. Now since the flow is configured, let's test the flow
191+
7. Now since the flow is configured, let's test the flow
145192
<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"/>
146193

147194
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)