Thep Excel

Table.Combine – รวมหลายตารางเข้าด้วยกัน (Append)

รวมหลายตารางเข้าด้วยกัน (Append)

รวมข้อมูลจากหลายตารางมาต่อกัน (Append)

=Table.Combine(tables as list) as table

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=Table.Combine(tables as list) as table

Argument Type Required Default Description
tables list Yes List ของตารางที่ต้องการนำมารวมกัน (เช่น {Table1, Table2})

Examples

ตัวอย่างที่ 1: รวม Sales 2 ปี

นำข้อมูลปี 2023 และ 2024 มาต่อกันเป็นตารางเดียว (Append)
Power Query Formula:

let
    Sales2023 = Table.FromRecords({
        [Month = "Jan", Sales = 1000],
        [Month = "Feb", Sales = 1500]
    }),
    Sales2024 = Table.FromRecords({
        [Month = "Jan", Sales = 2000],
        [Month = "Feb", Sales = 2500]
    }),
    Combined = Table.Combine({Sales2023, Sales2024})
in
    Combined

Result:

ตารางรวม 4 แถว (Jan 2023, Feb 2023, Jan 2024, Feb 2024)

ตัวอย่างที่ 2: รวมหลายไฟล์

รวมข้อมูลจากหลายไฟล์ Excel มาเป็นตารางเดียว
Power Query Formula:

let
    File1 = Excel.Workbook(File.Contents("C:\Data\File1.xlsx")),
    File2 = Excel.Workbook(File.Contents("C:\Data\File2.xlsx")),
    File3 = Excel.Workbook(File.Contents("C:\Data\File3.xlsx")),
    AllData = Table.Combine({File1, File2, File3})
in
    AllData

Result:

ตารางรวมจาก 3 ไฟล์

ตัวอย่างที่ 3: รวมตารางที่มีคอลัมน์ไม่ตรงกัน

Table.Combine จะสร้างคอลัมน์ครบทุกตัว และใส่ null ในช่องที่ไม่มีข้อมูล
Power Query Formula:

let
    Table1 = Table.FromRecords({
        [Name = "Bob", Age = 30]
    }),
    Table2 = Table.FromRecords({
        [Name = "Jim", City = "Bangkok"]
    }),
    Combined = Table.Combine({Table1, Table2})
in
    Combined

Result:

ตารางที่มีคอลัมน์ Name, Age, City (ค่าว่างในช่องที่ไม่มีข้อมูล)

Resources & Related

Additional Notes

ฟังก์ชัน Table.Combine ใน Power Query ใช้สำหรับรวมข้อมูลจากหลายตารางมาต่อกัน (Append)

Leave a Reply

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