---
title: quote – ฟังก์ชันห่อข้อความด้วยคำพูด
url: https://www.thepexcel.com/functions/n8n/string-functions/quote-n8n/
type: function-explainer
program: n8n
syntax: quote(text)
date: 2025-12-16
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 2
  usefulness: 4
---

# quote – ฟังก์ชันห่อข้อความด้วยคำพูด

> ห่อข้อความด้วยเครื่องหมายคำพูด

## คำอธิบาย

quote ห่อข้อความด้วยเครื่องหมายคำพูด (double quotes) ฟังก์ชันนี้มีประโยชน์ในการสร้าง CSV strings, JSON data, หรือสำหรับการแสดงผลที่ต้องการคำพูด

## Syntax

```excel
quote(text)
```

**Variant**

```excel
$json.message.quote()
```

ใช้เป็น method เมื่อ $json.message เป็น string

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| text | Yes | string |  | ข้อความที่ต้องการห่อด้วยคำพูด |

## เคสการใช้งาน

### สร้าง CSV Data

ห่อคอลัมน์ CSV ด้วยคำพูดเพื่อให้ถูกต้องตามมาตรฐาน CSV

_เหมาะกับ:_ csv-formatting

### จัดรูปแบบข้อความ

ห่อข้อความด้วยคำพูดเพื่อแสดงผลหรือสำหรับการประมวลผลข้อความ

_เหมาะกับ:_ text-formatting

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ห่อข้อความด้วยคำพูด

```excel
{{ quote('hello world') }}
```

**ผลลัพธ์:** `"hello world"`

ฟังก์ชันห่อ 'hello world' ด้วยเครื่องหมายคำพูด

### 2. ตัวอย่างที่ 2: สร้าง CSV Line

```excel
{{ [quote('John'), quote('john@example.com'), quote('123')].join(',') }}
```

**ผลลัพธ์:** `"John","john@example.com","123"`

สูตรนี้สร้าง CSV line โดยห่อแต่ละคอลัมน์ด้วยคำพูด

### 3. ตัวอย่างที่ 3: ห่อข้อมูล

```excel
{{ $json.names.map(n => quote(n)) }}
```

**ผลลัพธ์:** `["Name1", "Name2", "Name3", ...]`

ดึงชื่อทั้งหมดแล้วห่อแต่ละชื่อด้วยคำพูด

## หมายเหตุเพิ่มเติม

⚠️ ฟังก์ชัน quote() ใช้ double quotes เท่านั้น สำหรับการจัดรูปแบบ CSV ตรวจสอบให้แน่ใจว่าข้อมูลไม่มี quotes ที่จะสร้างปัญหา

## คำถามที่พบบ่อย

**Q: quote() จะใช้เครื่องหมายใด?**

quote() ใช้ double quotes (") หากต้องการเครื่องหมายอื่น ให้ใช้ concat() แทน

**Q: quote() จะจัดการ quotes ที่มีอยู่ในข้อความได้หรือ?**

ไม่ quote() เพียงแค่เพิ่มคำพูดรอบ หากข้อความมีคำพูด ต้องดำเนินการ escape ด้วยตนเอง

**Q: ใช้ quote() เมื่อไหร่ในการทำงาน?**

ใช้เมื่อต้องการห่อข้อความด้วยคำพูด เช่นสร้าง CSV, JSON, หรือจัดรูปแบบข้อความ

## ฟังก์ชันที่เกี่ยวข้อง

- [concat – ฟังก์ชันต่อข้อความหลาย ๆ ตัว](https://www.thepexcel.com/functions/n8n/string-functions/concat-n8n/)
- [join – แปลงอาร์เรย์เป็นข้อความด้วยตัวคั่น](https://www.thepexcel.com/functions/n8n/array-functions/join-n8n/)
- [map – แปลงแต่ละรายการในอาร์เรย์ (transform elements)](https://www.thepexcel.com/functions/n8n/array-functions/map-n8n/)
- [replace – แทนที่ข้อความหรือ pattern ตัวแรกที่พบใน string](https://www.thepexcel.com/functions/n8n/string-functions/replace-n8n/)
- [trim – ลบ whitespace หน้าและหลังข้อความ](https://www.thepexcel.com/functions/n8n/string-functions/trim-n8n/)

---

_Source: [https://www.thepexcel.com/functions/n8n/string-functions/quote-n8n/](https://www.thepexcel.com/functions/n8n/string-functions/quote-n8n/)_
