Difference between revisions of "Qubot Google Sheets Setup"

From QuData
Jump to navigation Jump to search
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<span id="qubot-google-sheets-setup"></span>
 
<span id="qubot-google-sheets-setup"></span>
 
{{TOCright}}
 
{{TOCright}}
== Подключение Google таблиц к боту ==
+
== Connecting Google Sheets to a Bot ==
  
Подключив электронные таблицы Google, вы значительно улучшите работу с ботом. Например,  
+
By connecting your Google spreadsheets to the bot, your bot experience will improve significantly. For example, your bot will be able to download data directly from your Google spreadsheet, as well as upload new data in real time. Using Google Sheets will make your work much easier, because you will have direct access to read and edit the saved data at any time without interfering with the bot code.
ваш бот сможет загружать данные прямо из вашей электронной таблицы Google, а также загружать новые данные в режиме реального времени.  
 
Использование Google таблиц значительно облегчит вашу работу, поскольку вы будете иметь прямой доступ к чтению и редактированию сохраненных данных в любое время,
 
не вмешиваясь в код бота.
 
  
Для подключения таблиц следуйте шагам описанным ниже:
+
The instructions below will help you to share Google spreadsheets:
== Шаг 1 ==
+
== Step 1 ==
  
Войдите или же создайте аккаунт на https://accounts.google.com
+
Sign in or create an account at https://accounts.google.com
 
<br>
 
<br>
 
<br>
 
<br>
Line 18: Line 15:
 
<br>
 
<br>
  
== Шаг 2 ==
+
== Step 2 ==
  
Откройте свои Google таблицы здесь https://docs.google.com/spreadsheets
+
Open your Google Sheets here https://docs.google.com/spreadsheets
  
Вы также можете получить доступ к своим таблицам Google с главной страницы Google, нажав кнопку приложений Google.
+
You can also access your Google Sheets from the Google homepage(https://www.google.com/) by clicking the Google apps button.
 
<br>
 
<br>
 
<br>
 
<br>
Line 28: Line 25:
 
<br>
 
<br>
  
== Шаг 3 ==
+
== Step 3 ==
  
Поделитесь Google таблицей с ботом:
+
Share the Google Spreadsheet with your bot:
  
В Google таблицах откройте электронную таблицу и нажмите кнопку Share(Поделиться).
+
In your Google Sheets, open a spreadsheet and click the Share button.
 
<br>
 
<br>
 
<br>
 
<br>
Line 38: Line 35:
 
<br>
 
<br>
 
<br>
 
<br>
Предоставьте доступ любым из возможных способов.
+
Share the access in any of the possible ways.
Первый способ. Поделиться с определенной учетной записью: скопируйте следующую учетную запись в поле ввода окна обмена и отправьте приглашение.
+
First way. Share with a specific account: copy the following account into the input field of the sharing window and send the invitation.
  
 
'''qudata-bot-service@qudata-services.iam.gserviceaccount.com'''
 
'''qudata-bot-service@qudata-services.iam.gserviceaccount.com'''
Line 47: Line 44:
 
<br>
 
<br>
 
<br>
 
<br>
Второй способ. Ссылка для общего доступа: в разделе Get link(Получить ссылку) измените статус Restricted(ограниченный доступ) на Anyone with the link(все, у кого есть ссылка), и нажать Готово.
+
Second way. Get shareable link: in the Get link section change status Restricted to Anyone with the link, and click Done.
 
<br>
 
<br>
 
<br>
 
<br>
Line 53: Line 50:
 
<br>
 
<br>
 
<br>
 
<br>
Обратите внимание, что вы можете контролировать доступ: если бот будет считывать данные только из таблицы Google,  
+
Please note that you can control the access: if the bot will only read data from Google spreadsheet, then the Viewer role is enough, and if the bot will also save data to Google spreadsheet, then the Editor role is required. You can change the role at any time in the sharing settings.
то достаточно роли Viewer, а если бот еще и сохраняет данные в таблицу Google, то требуется роль Editor.  
 
Вы можете изменить роль в любое время в настройках общего доступа.
 
  
== Шаг 4 ==
+
== Step 4 ==
  
Настройте загрузку данных в таблицу в редакторе бота. Дополнительную информацию об этом можно
+
Set up data loading to a spreadsheet in the bot editor. Additional information about this can be found in the bot editor templates (e.g. Trivia, Order Food templates) or in our help center.
найти в шаблонах редактора ботов (например, Trivia, шаблоны Order Food) или в нашем справочном центре.
 
== Настройка работы с данными Google  таблиц в боте ==
 
  
Выберите нужного вам бота. Зайдите в Editor(Редактор) бота.
+
== How to set up Google Spreadsheet data in a bot ==
  
'''Загрузка данных с таблицы'''
+
Choose the required bot and go to the Editor.
  
1. Выберите нужный шаг в вашем боте где нужно загрузить данные с google таблицы(К примеру Main).
+
'''Loading data from a spreadsheet'''
 +
 
 +
1. Select a step in your bot to download data from the Google Sheets (for example, Main).
 
<br>
 
<br>
 
<br>
 
<br>
Line 73: Line 68:
 
<br>
 
<br>
 
<br>
 
<br>
2. Выберите/создайте элемент, действием которого должна быть загрузка данных с таблицы. Это может быть Buttons(кнопка), элемент Actions(действие), просто ввод любого текста пользователем(click to show actions when) и другие элементы.
+
2. Select/create an element to have its action load data from the spreadsheet. It can be buttons, actions or just entering any text by the user (click to show actions when) and other elements.
 
<br>
 
<br>
 
<br>
 
<br>
 
[[File:EditorGoogleSheet2.png|250px]]  [[File:EditorGoogleSheet3.png|250px]]
 
[[File:EditorGoogleSheet2.png|250px]]  [[File:EditorGoogleSheet3.png|250px]]
 
<br>
 
<br>
3. В поле Item properties у вас появится возможность добавить свойство:
+
3. In the Item properties field you can add a property:
 
<br>
 
<br>
 
<br>
 
<br>
 
[[File:EditorGoogleSheet4.png|250px]]  [[File:EditorGoogleSheet5.png|250px]]
 
[[File:EditorGoogleSheet4.png|250px]]  [[File:EditorGoogleSheet5.png|250px]]
 
<br>
 
<br>
4. Выберите свойство load:
+
4. Select the load property:
 
<br>
 
<br>
 
<br>
 
<br>
Line 89: Line 84:
 
<br>
 
<br>
 
<br>
 
<br>
5. В свойстве load выберите из списка Google Sheets
+
5. In the load property  select Google Sheets from the list
 
<br>
 
<br>
 
<br>
 
<br>
Line 95: Line 90:
 
<br>
 
<br>
 
<br>
 
<br>
6. В поле Google Sheets table url введите url(ссылку) вашей google таблицы
+
6. In the Google Sheets table url field enter the url (link) of your Google Sheet
 
<br>
 
<br>
 
<br>
 
<br>
Line 103: Line 98:
 
[[File:EditorGoogleSheet9.png|400px]]
 
[[File:EditorGoogleSheet9.png|400px]]
 
<br>
 
<br>
7. В поле Slot name введите имя переменной, в которой будут хранится данные с вашей таблицы в виде массива объектов:
+
7. In the Slot name field enter the name of the variable that will store data from your spreadsheet as an array of objects:
 
<br>
 
<br>
 
<br>
 
<br>
Line 109: Line 104:
 
<br>
 
<br>
 
<br>
 
<br>
Используйте эту переменную для работы с вашими данными.
+
Use this variable to work with your data.
  
'''''Убедитесь, что вы дали доступ на чтение или редактирование своей таблицы'''''
+
'''''Make sure you give access to view or edit your spreadsheet'''''
  
'''Запись данных в таблицу'''
+
'''Sending data to a spreadsheet'''
  
Пройдите шаги 1-3 описанных выше в "Загрузка данных с таблицы" выбрав шаг на котором нужно сделать запись в таблицу.
+
Go through steps 1-3 described above in "Loading data from a spreadsheet" and choose a step where to send data to the spreadsheet.
  
4. Выберите свойство save:
+
4. Select the save property:
 
<br>
 
<br>
 
<br>
 
<br>
Line 123: Line 118:
 
<br>
 
<br>
 
<br>
 
<br>
5. В свойстве save выберите из списка Google Sheets
+
5. In the save property select Google Sheets from the list
 
<br>
 
<br>
 
<br>
 
<br>
Line 129: Line 124:
 
<br>
 
<br>
 
<br>
 
<br>
6. В поле Google Sheets table url введите url(ссылку) вашей google таблицы
+
6. In the Google Sheets table url field enter the url (link) of your Google Sheet
 
<br>
 
<br>
 
<br>
 
<br>
Line 137: Line 132:
 
[[File:EditorGoogleSheet13.png|400px]]
 
[[File:EditorGoogleSheet13.png|400px]]
 
<br>
 
<br>
7. В поле Data value введите данные, которые будут записаны в таблицу в указанном формате в виде объекта:
+
7. In the Data value field enter the data that will be sent to the spreadsheet in the specified format as an object:
 
<br>
 
<br>
 
[[File:EditorGoogleSheet14.png|250px]]  [[File:EditorGoogleSheet15.png|250px]]
 
[[File:EditorGoogleSheet14.png|250px]]  [[File:EditorGoogleSheet15.png|250px]]
 
<br>
 
<br>
'''''Убедитесь, что вы дали доступ на редактирование своей таблицы'''''
+
'''''Make sure you give access to edit your spreadsheet'''''
 +
 
 +
== Working with filters ==
 +
 
 +
You can use filters to receive selective data or change existing ones  from the bot.<br>
 +
Filters are a data dictionary with the following structure: { 'COLUMN': DATA, ... }<br>
 +
You can specify multiple columns in one filter.<br>
 +
All columns in one filter are considered as a logical "AND", that means the filter will look for those rows that have all the specified data in all the specified columns.
 +
 
 +
'''Selective data loading from the table'''
 +
 
 +
1. Set up your bot to load data according to the instructions above.<br>
 +
2. Specify a filter in the form of a dictionary in the Data filter field.<br>
 +
[[File:GoogleSheets16.png|350px]]<br>
 +
3. Only values from the columns, that correspond to the entered, will be recorded as data to the SLOT_DATA dictionary.<br>
 +
 
 +
 
 +
'''Editing data in the table'''
 +
 
 +
1. Set up your bot to save data according to the instructions above.<br>
 +
2. Specify a filter in the form of a dictionary in the Data filter field.<br>
 +
[[File:GoogleSheets17.png|350px]]<br>
 +
3. Data from the table that match the filter will be edited.<br>
 +
''If the filter did not work, then the data will not be recorded''.<br>
 +
 
 +
 
 +
'''''Make sure you give access to edit your spreadsheet'''''
 
[[Category:Qubot]]
 
[[Category:Qubot]]

Latest revision as of 15:16, 12 September 2022

Connecting Google Sheets to a Bot

By connecting your Google spreadsheets to the bot, your bot experience will improve significantly. For example, your bot will be able to download data directly from your Google spreadsheet, as well as upload new data in real time. Using Google Sheets will make your work much easier, because you will have direct access to read and edit the saved data at any time without interfering with the bot code.

The instructions below will help you to share Google spreadsheets:

Step 1

Sign in or create an account at https://accounts.google.com

GoogleSheets1.png

Step 2

Open your Google Sheets here https://docs.google.com/spreadsheets

You can also access your Google Sheets from the Google homepage(https://www.google.com/) by clicking the Google apps button.

GoogleSheets2.png GoogleSheets3.png

Step 3

Share the Google Spreadsheet with your bot:

In your Google Sheets, open a spreadsheet and click the Share button.

GoogleSheets4.png

Share the access in any of the possible ways. First way. Share with a specific account: copy the following account into the input field of the sharing window and send the invitation.

qudata-bot-service@qudata-services.iam.gserviceaccount.com

GoogleSheets5.png

Second way. Get shareable link: in the Get link section change status Restricted to Anyone with the link, and click Done.

GoogleSheets6.png

Please note that you can control the access: if the bot will only read data from Google spreadsheet, then the Viewer role is enough, and if the bot will also save data to Google spreadsheet, then the Editor role is required. You can change the role at any time in the sharing settings.

Step 4

Set up data loading to a spreadsheet in the bot editor. Additional information about this can be found in the bot editor templates (e.g. Trivia, Order Food templates) or in our help center.

How to set up Google Spreadsheet data in a bot

Choose the required bot and go to the Editor.

Loading data from a spreadsheet

1. Select a step in your bot to download data from the Google Sheets (for example, Main).

EditorGoogleSheet1.png

2. Select/create an element to have its action load data from the spreadsheet. It can be buttons, actions or just entering any text by the user (click to show actions when) and other elements.

EditorGoogleSheet2.png EditorGoogleSheet3.png
3. In the Item properties field you can add a property:

EditorGoogleSheet4.png EditorGoogleSheet5.png
4. Select the load property:

EditorGoogleSheet6.png

5. In the load property select Google Sheets from the list

EditorGoogleSheet7.png

6. In the Google Sheets table url field enter the url (link) of your Google Sheet

EditorGoogleSheet8.png

EditorGoogleSheet9.png
7. In the Slot name field enter the name of the variable that will store data from your spreadsheet as an array of objects:

EditorGoogleSheet10.png

Use this variable to work with your data.

Make sure you give access to view or edit your spreadsheet

Sending data to a spreadsheet

Go through steps 1-3 described above in "Loading data from a spreadsheet" and choose a step where to send data to the spreadsheet.

4. Select the save property:

EditorGoogleSheet11.png

5. In the save property select Google Sheets from the list

EditorGoogleSheet12.png

6. In the Google Sheets table url field enter the url (link) of your Google Sheet

EditorGoogleSheet8.png

EditorGoogleSheet13.png
7. In the Data value field enter the data that will be sent to the spreadsheet in the specified format as an object:
EditorGoogleSheet14.png EditorGoogleSheet15.png
Make sure you give access to edit your spreadsheet

Working with filters

You can use filters to receive selective data or change existing ones from the bot.
Filters are a data dictionary with the following structure: { 'COLUMN': DATA, ... }
You can specify multiple columns in one filter.
All columns in one filter are considered as a logical "AND", that means the filter will look for those rows that have all the specified data in all the specified columns.

Selective data loading from the table

1. Set up your bot to load data according to the instructions above.
2. Specify a filter in the form of a dictionary in the Data filter field.
GoogleSheets16.png
3. Only values from the columns, that correspond to the entered, will be recorded as data to the SLOT_DATA dictionary.


Editing data in the table

1. Set up your bot to save data according to the instructions above.
2. Specify a filter in the form of a dictionary in the Data filter field.
GoogleSheets17.png
3. Data from the table that match the filter will be edited.
If the filter did not work, then the data will not be recorded.


Make sure you give access to edit your spreadsheet