Thep Excel

append – เพิ่มค่าต่อท้ายอาร์เรย์

append() เป็น n8n-specific array extension (ไม่ใช่ JavaScript method มาตรฐาน) เพิ่มค่าหรือรายการใหม่ต่อท้ายอาร์เรย์ คืนค่าเป็นอาร์เรย์ใหม่ (immutable – ไม่แก้ไขอาร์เรย์เดิม) มีประโยชน์ในการเพิ่มรายการใหม่ รวมข้อมูลจากหลายแหล่ง หรือสร้างอาร์เรย์แบบ incremental

=array.append(value)

By ThepExcel AI Agent
16 December 2025

Function Metrics


Popularity
7/10

Difficulty
2/10

Usefulness
7/10

Syntax & Arguments

=array.append(value)

Argument Type Required Default Description
value any Yes ค่าที่ต้องการเพิ่มต่อท้ายอาร์เรย์ (สามารถเป็น string, number, object, หรือ array ก็ได้)

How it works

เพิ่มรายการใหม่จาก API

เพิ่มข้อมูลใหม่ที่รับจาก API call ต่อท้ายอาร์เรย์ที่มีอยู่

รวมข้อมูลจากหลายแหล่ง

เพิ่มรายการจากแหล่งข้อมูลต่างๆ เข้าด้วยกันเป็นอาร์เรย์เดียว

สร้าง log entries

เพิ่ม log entry ใหม่ต่อท้าย log array สำหรับ tracking

Examples

ตัวอย่างที่ 1: เพิ่มตัวเลขต่อท้าย
{{ [1, 2, 3].append(4) }}
เพิ่ม 4 ต่อท้าย [1, 2, 3] ได้ [1, 2, 3, 4]
n8n Formula:

={{ [1, 2, 3].append(4) }}

Result:

[1, 2, 3, 4]

ตัวอย่างที่ 2: เพิ่ม object ต่อท้าย
{{ [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }].append({ id: 3, name: 'Bob' }) }}
เพิ่ม object ใหม่ต่อท้าย array of objects
n8n Formula:

={{ [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }].append({ id: 3, name: 'Bob' }) }}

Result:

[{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }, { id: 3, name: 'Bob' }]

ตัวอย่างที่ 3: เพิ่มรายการลงในอาร์เรย์ว่าง
{{ [].append('first item') }}
เพิ่ม 'first item' ลงในอาร์เรย์ว่าง สร้างอาร์เรย์ใหม่ที่มี 1 รายการ
n8n Formula:

={{ [].append('first item') }}

Result:

['first item']

ตัวอย่างที่ 4: Chain multiple append
{{ [1, 2].append(3).append(4).append(5) }}
Chain หลาย append() เพื่อเพิ่มหลายค่าต่อท้าย ได้ [1, 2, 3, 4, 5]
n8n Formula:

={{ [1, 2].append(3).append(4).append(5) }}

Result:

[1, 2, 3, 4, 5]

FAQs

append() กับ push() ต่างกันอย่างไร?

append() คืนค่าอาร์เรย์ใหม่ (immutable, ไม่แก้ไขอาร์เรย์เดิม) ส่วน push() แก้ไขอาร์เรย์เดิมโดยตรง (mutable) ใน n8n ส่วนใหญ่ใช้ append() เพราะรักษา immutability ของ expressions

append() รองรับการเพิ่มหลายค่าพร้อมกันหรือไม่?

ไม่ append() เพิ่มทีละ 1 ค่า ถ้าต้องการเพิ่มหลายค่าใช้ chain: array.append(1).append(2).append(3) หรือใช้ concat() เพื่อรวม 2 arrays: [1,2].concat([3,4,5])

append() กับ concat() ต่างกันอย่างไร?

append() เพิ่มค่าเดียว (เช่น item หรือ array as single element) ส่วน concat() รวม arrays (flatten elements) เช่น [1,2].append([3,4]) ได้ [1,2,[3,4]] แต่ [1,2].concat([3,4]) ได้ [1,2,3,4]

ใช้ append() เมื่อไหร่?

ใช้เมื่อต้องการเพิ่มรายการเดียวต่อท้ายอาร์เรย์ เช่น เพิ่มข้อมูลใหม่จาก API สร้าง log entries หรือรวมรายการจากหลายแหล่ง ใช้ concat() แทนถ้าต้องการรวม arrays ใช้ push() ถ้าต้องการแก้ไขอาร์เรย์เดิม (ไม่แนะนำใน n8n)

Resources & Related

Additional Notes

append() เป็น n8n-specific array extension ที่เพิ่มค่าหรือรายการใหม่ต่อท้ายอาร์เรย์ คืนค่าเป็นอาร์เรย์ใหม่ที่มีค่าเดิมบวกกับค่าที่เพิ่มเข้าไป ไม่แก้ไขอาร์เรย์เดิม

Leave a Reply

Your email address will not be published. Required fields are marked *