# Google sheet

## 1. **Lợi ích của tích hợp Google Sheet vào Getfly CRM**

* Nhập liệu nhanh chóng: Dễ dàng đồng bộ dữ liệu khách hàng từ Google Sheet vào CRM chỉ với vài thao tác.
* Tăng hiệu suất phối hợp: Giúp các phòng ban sử dụng chung dữ liệu, giảm trùng lặp và tăng hiệu quả xử lý.

## 2. **Các bước thao tác kết nối**&#x20;

**Lưu ý**: Đăng nhập mail tạo sheet trùng với tài khoản google trước khi kết nối&#x20;

### Bước 1.&#x20;

Truy cập vào: [https://console.cloud.google.com](https://console.cloud.google.com/) để thực hiện tạo 1 project

&#x20;Bấm select a project => Chọn tiếp **New project**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3362).png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3376).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 2.

Mục Project name: đặt tên dự án bất kỳ và Bấm **“Create”**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3377).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

\- Sau khi “Create” xong sẽ hiển thị thông báo tạo dự án thành công

\- Sau đó người dùng bấm vào biểu tượng quả chuông thông báo và chọn **“Select Project”** như hình ảnh&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3378).png" alt="" width="563"><figcaption></figcaption></figure>

Sau đó màn hình cài đặt sẽ được hiển thị

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3366).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 3.

Thực hiện bấm chọn **APIs & Services > Enabled APIs & Services**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3379).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

Sau đó bấm **“Enable APIs and services”**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3380).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 4.

Màn hình API Library hiển thị&#x20;

Ở ô tìm kiếm gõ “**Apps Script API”** như hình dưới và **ấn phím Enter**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3381).png" alt="" width="563"><figcaption></figcaption></figure>

<br>

### Bước 5.

Sau khi gõ Enter, kết quả tìm kiếm hiển thị “Apps Script API”. **Bấm vào “Apps Script API**” như ảnh dưới

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3382).png" alt="" width="563"><figcaption></figcaption></figure>

Sau đó ấn nút **Enable**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3383).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 6.&#x20;

Sau khi Enable xong, tiếp tục bấm vào **“Create credentials”** như hình ảnh&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3384).png" alt="" width="563"><figcaption></figcaption></figure>

Sau đó, ở trường Select an API chọn **“Apps Script API”** và tích chọn **“User data”** và bấm **“Next**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3385).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 7.

Nhập các thông tin ở mục **2- OAuth consent Screen**

* App name: Getfly CRM - Đồng bộ Google Sheet
* User support name: Chọn email, là email đang dùng để thiết lâp kết nối&#x20;
* Developer contact information: Nhập email đang kết nối&#x20;
* **Ấn Save and continue**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3375).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 8.

Nhập các thông tin ở mục **3- Scopes (optional)**

Bấm **“Save and continue”**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3386).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 9.

Nhập thông tin ở mục **4- OAuth Client ID**

Chọn Application type là **“Web application”** , name: để nguyên thông tin là Web clinet 1\
&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3387).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

Bấm nút **“+ Add URI”** ở trường **“Authorized JavaScript origins”** và nhập vào là [https://script.google.com](https://script.google.com/)&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3388).png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3389).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 10.

Tiếp theo mở tab mới, vào link Google Sheet cần đồng bộ > chọn **Extensions (Tiện ích)** > chọn **Apps Script** như ảnh dưới

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3390).png" alt="" width="563"><figcaption></figcaption></figure>

\
Sau khi bấm Apps Script. Hiển thị màn như ảnh dưới. Đồng thời thực hiện COPY đoạn mã sau chữ “projects/” và trước “/edit” như ảnh bên dưới, kết quả được dãy ký tự ví dụ như sau: **1pkNskZFwwHYlBD9aFE2m3xRiLAnJOn5ya8QPcebZPzzv4ziQVUFowKha**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3392).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 11.

Thay dãy ký tự vừa lấy đươc ở Bước 10 vào đường dẫn sau và copy lại thông tin [**https://script.google.com/macros/d/your\_script\_id/usercallback**](https://script.google.com/macros/d/your_script_id/usercallback)

[**your\_script\_id**](https://script.google.com/macros/d/your_script_id/usercallback) chính là dãy ký tự vừa lấy được ở bước trên&#x20;

\+ Kết quả có dạng như sau và copy lại thông tin [https://script.google.com/macros/d/](https://script.google.com/macros/d/your_script_id/usercallback)1pkNskZFwwHYlBD9aFE2m3xRiLAnJOn5ya8QPcebZPzzv4ziQVUFowKha[/usercallback](https://script.google.com/macros/d/your_script_id/usercallback)

### Bước 12.

Quay lại màn hình đang thiết lập kết nối ở Bước 9

Bấm “**+Add URI”** trường **“Authorized redirect URIs”** và paste kết quả vừa mới copy ở bước 11 vào&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3393).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

Kết quả các thông tin hiển thị như hình dưới và bấm **“Create"**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3394).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 13.

Ở mục **5 - Your Credentials** ấn **Done**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3395).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 14.

Click vào dấu 3 gạch để vào lại menu, sau đó chọn **APIs & Services > OAuth consent screen**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3396).png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3397).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

### Bước 15.

Tiếp theo chọn **Audience**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3398).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Ở **Publishing status** -> bấm **“Publish app”** -> Bấm **“Confirm**”

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3399).png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3400).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

Màn hình sẽ hiển thị như sau&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3401).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 16.

Click vào dấu 3 gạch để vào lại menu, chọn **IAM & Admin >** chọn **Settings**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3402).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Thực hiện copy **“Project number**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3403).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 17.

Quay lại màn hình Apps script của Google Sheet → chọn **Project Setting (Cài đặt dự án)**\
&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3404).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 18.

Bấm **“Change Project”  ( Thay đổi dự án)**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3405).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

Tiếp theo **paste “Project number”** mà mới copy ở bước 16 và ấn **“Set project” ( Đặt dự án)**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3406).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

\+ Kết quả hiển thị như màn sau:&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3407).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 19.

Truy cập Vào hệ thống Getfly CRM ( dùng tài khoản admin hoặc tài khoản có quyền tích hợp)&#x20;

\+ Kiểm tra xem đã tạo API kết nối với phần mềm khác trên Getfly hay chưa theo hướng dẫn <https://wiki.getfly.vn/portal/post/2491>&#x20;

\+ Thao tác vào **Cài đặt -> Tích hợp -> Tích hợp phần mềm khác -> Kết nối Google sheet**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3408).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Cấu hình các trường thông tin trên Getfly tương ứng các cột thông tin trong sheet

Ví dụ: Tên Khách hàng trên Getfly ứng với cột tên KH trong bảng tính sheet\
\
\+ Bật **Kích hoạt** và ấn **Cập nhật**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3424).png" alt="" width="563"><figcaption></figcaption></figure>

\
\+ Ấn **Sao chép**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3409).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 20.

Quay lại màn hình Apps script của Google Sheet → chọn **Editor ( Trình biên tập)**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3410).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

\+ Vào mục **code.gs**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3411).png" alt="" width="563"><figcaption></figcaption></figure>

Ấn phím **ctrl + v để paste** phần code vừa sao chép trên phần mềm và **bấm ctrl +s để lưu lại**. Kết quả như ảnh sau:&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3413).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 21.

Tiếp sao ấn vào **“Triggers” (Kích hoạt)** như sau:

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3414).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

\+ Click vào **“Add Triggers” ( Thêm mới kích hoạt)**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3415).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Màn hình hiển thị như sau, Ở **“Select event type”** chọn dòng thứ 3 là loại **“On change”** và bấm **“Save"**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3417).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 22.

Sau khi bấm “Save” màn hình hiển thị như ảnh dưới và bấm vào tài khoản google (là tài khoản đang dùng để kết nối)&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3418).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Tiếp theo bấm **“Advanced”**

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3419).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

\+ Bấm **Go to Getfly CRM - Đồng bộ Google Sheet (unsafe)**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3420).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Tiếp theo bấm **“Allow”**&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3421).png" alt="" width="563"><figcaption></figcaption></figure>

\+ Sau đó sẽ hiển thị 1 dòng như ảnh&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3422).png" alt="" width="563"><figcaption></figcaption></figure>

### Bước 23.

Mở bảng tính google sheet, thực hiện thêm 1 dòng mới để kiểm tra&#x20;

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3428).png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://wiki.getfly.vn/public/img/images/image(3427).png" alt="" width="563"><figcaption></figcaption></figure>

&#x20;

**Lưu ý:**&#x20;

1. Hệ thống chỉ đồng bộ dữ liệu từ Google Sheets về phần mềm đối với các dòng mới. Các dòng chỉnh sửa/xóa đã đồng bộ sẽ không được cập nhật lại
2. Các trường như người tạo, người phụ trách Nếu bảng tính google sheet không có cột người tạo/người phụ trách thì không ghi nhận người tạo KH, nếu có cột người tạo/người phụ trách thì sẽ ghi nhận thông tin và thông tin điền là tên đăng nhập của tài khoản Getfly
3. Đối với các trường dữ liệu dạng seleclist: Các giá trị được chọn trong select list của Google Sheet cần giống hoàn toàn với các option đã định nghĩa trên Getfly. Nếu không trùng khớp, hệ thống không ghi nhận giá trị đó và để trống&#x20;
4. Nguồn khách hàng có đổ về Getfly với điều kiện nguồn khách hàng phải đã được khai báo trên hệ thống. Nếu không tồn tại thì mặc định khi đổ về phần mềm, nguồn sẽ là rỗng
5. Nếu 1 bảng tính có đồng thời nhiều sheet thì tất cả thông tin ở các sheet đều đổ dữ liệu về CRM được
6. Trường hợp bảng tính được chia sẻ cho nhiều tài khoản mail, thì tất cả tài khoản đều có quyền đẩy dữ liệu từ google sheet về phần mềm


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpdesk6.getfly.vn/phien-ban-web/doi-tac-ket-noi/google-sheet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
