---
title: Binary.Combine – รวม Binary หลายตัวเป็นตัวเดียว
url: https://www.thepexcel.com/functions/power-query/binary-functions/binary-combine/
type: function-explainer
program: Power Query
syntax: Binary.Combine(binaries as list) as binary
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 4
  usefulness: 4
---

# Binary.Combine – รวม Binary หลายตัวเป็นตัวเดียว

> รวมรายการของค่า Binary หลายตัวเป็นค่า Binary ตัวเดียว

## คำอธิบาย

Binary.Combine รับรายการค่า Binary หลายตัวและรวมเข้าเป็นค่า Binary ตัวเดียว ลำดับของ Bytes ในผลลัพธ์จะตามลำดับของรายการที่ส่งเข้ามา

## Syntax

```excel
Binary.Combine(binaries as list) as binary
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| binaries | Yes | list |  | รายการของค่า Binary ที่ต้องการรวม แต่ละค่าใน List ต้องเป็น Binary ผลลัพธ์จะรวม Bytes ตามลำดับของรายการ |

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

### รวมชิ้นส่วน Binary จากการถูเก็บแบบแยก

เมื่อ Binary ถูกแบ่งและเก็บแยกกัน ใช้ Binary.Combine เพื่อรวมกลับเป็นชิ้นเดียวคืน

### สร้างโครงสร้าง Binary ที่ซับซ้อน

รวม Binary หลายส่วน (Header, Payload, Footer) เข้าเป็นข้อมูล Binary ที่สมบูรณ์

### การจัดการข้อมูลที่โหลดทีละส่วน

รวม Binary ที่มาจากการโหลดแบบ Streaming หรือหลายครั้งเข้าเป็นตัวเดียว

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: รวม Binary ง่ายๆ 2 ตัว

```excel
Binary.Combine({Binary.FromList({1, 2, 3}), Binary.FromList({4, 5, 6})})
```

**ผลลัพธ์:** `#binary({1, 2, 3, 4, 5, 6})`

รวม 2 ค่า Binary ที่สร้างจากรายการตัวเลข ผลลัพธ์รวม Bytes ทั้งหมดตามลำดับ: {1,2,3} จาก Binary แรก ตามด้วย {4,5,6} จาก Binary ที่สอง

### 2. ตัวอย่างที่ 2: รวม Binary สาม Header Payload Footer

```excel
let
    Header = Binary.FromList({255, 254}),
    Payload = Binary.FromList({65, 66, 67}),
    Footer = Binary.FromList({0, 0}),
    Combined = Binary.Combine({Header, Payload, Footer})
in
    Combined
```

**ผลลัพธ์:** `#binary({255, 254, 65, 66, 67, 0, 0})`

สร้าง Binary จาก 3 ส่วน: Header (255,254) + Payload (65=A, 66=B, 67=C) + Footer (0,0) ใช้ Binary.Combine เพื่อรวม 3 ตัวเข้าเป็น Binary ตัวเดียว ผลลัพธ์เป็น Binary ที่มี 7 Bytes เรียงกันตามลำดับ

### 3. ตัวอย่างที่ 3: รวม Binary จากข้อความหลายตัว

```excel
let
    Part1 = Binary.FromText("Hello"),
    Part2 = Binary.FromText(" "),
    Part3 = Binary.FromText("World"),
    BinaryList = {Part1, Part2, Part3},
    Result = Binary.Combine(BinaryList)
in
    Result
```

**ผลลัพธ์:** `#binary({72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100})`

แปลง 3 ข้อความ "Hello" " " "World" เป็น Binary แยกกัน จากนั้นรวมเข้าเป็น Binary ตัวเดียว ผลลัพธ์เป็น Binary ของ "Hello World" (11 Bytes)

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

**Q: ลำดับของ Binary ในรายการจะส่งผลต่อผลลัพธ์หรือไม่?**

ใช่ ลำดับสำคัญมาก ผลลัพธ์จะรวม Bytes ตามลำดับที่ปรากฏในรายการ Binary.Combine({B1, B2, B3}) จะให้ผล B1+B2+B3 ไม่ใช่ B3+B2+B1

**Q: จะเกิดอะไรถ้าส่งรายการว่าง {}?**

Binary.Combine({}) จะคืนค่า Binary ว่าง #binary({}) ที่มี 0 Bytes

**Q: จำนวน Binary ในรายการมีขีดจำกัดหรือไม่?**

ไม่มีขีดจำกัดในเรื่องจำนวน แต่จำเป็นต้องระวังหน่วยความจำ Binary ที่รวมกันจำนวนมากจะใช้ Memory มาก

**Q: ความแตกต่างระหว่าง Binary.Combine และ List.Combine คืออะไร?**

Binary.Combine ใช้สำหรับรายการของค่า Binary (รายการในรายการ) ส่วน List.Combine ใช้สำหรับรายการของรายการต่างๆ (ประเภทใดก็ได้)

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

- [Binary.FromList – สร้างข้อมูลไบนารี่จากรายการ](https://www.thepexcel.com/functions/power-query/binary-functions/binary-fromlist/)
- [Binary.FromText – แปลงข้อความเป็นข้อมูลไบนารี่](https://www.thepexcel.com/functions/power-query/binary-functions/binary-fromtext/)
- [Binary.Split – แยกข้อมูลไบนารี่](https://www.thepexcel.com/functions/power-query/binary-functions/binary-split/)
- [List.Combine – รวม List](https://www.thepexcel.com/functions/power-query/list-functions/list-combine/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Binary.Combine](https://learn.microsoft.com/en-us/powerquery-m/binary-combine) _(Official Documentation)_
- [Power Query M Language - Binary Functions](https://learn.microsoft.com/en-us/powerquery-m/power-query-m-function-reference#binary) _(Function Reference)_

---

_Source: [https://www.thepexcel.com/functions/power-query/binary-functions/binary-combine/](https://www.thepexcel.com/functions/power-query/binary-functions/binary-combine/)_
