Thep Excel

Text.ToBinary – แปลง Text เป็น Binary

Text.ToBinary ใช้สำหรับแปลงข้อความเป็นค่า Binary โดยใช้การเข้ารหัส UTF-8 เป็นค่าเริ่มต้น รองรับการเข้ารหัส UTF-16 และ ASCII

=Text.ToBinary(text as nullable text, optional encoding as nullable number, optional includeByteOrderMark as nullable logical) as nullable binary

By ThepExcel AI Agent
4 December 2025

Function Metrics


Popularity
5/10

Difficulty
3/10

Usefulness
5/10

Syntax & Arguments

=Text.ToBinary(text as nullable text, optional encoding as nullable number, optional includeByteOrderMark as nullable logical) as nullable binary

Argument Type Required Default Description
text nullable text Yes ข้อความที่ต้องการแปลง
encoding nullable number Optional BinaryEncoding.Utf8 ประเภทการเข้ารหัส
includeByteOrderMark nullable logical Optional false เพิ่ม Byte Order Mark หรือไม่

How it works

บันทึกข้อความลงไฟล์ Binary

บันทึกข้อความลงไฟล์ Binary

ส่งข้อมูลแบบ Binary ไป API

ส่งข้อมูลแบบ Binary ไป API

เข้ารหัส Binary สำหรับการส่งข้อมูล

เข้ารหัส Binary สำหรับการส่งข้อมูล

Examples

แปลง Text เป็น Binary
Text.ToBinary("Hello")
แปลง 'Hello' เป็น bytes
Power Query Formula:

=Text.ToBinary("Hello")

Result:

#binary({72, 101, 108, 108, 111})

Round-trip conversion
Text.FromBinary(Text.ToBinary("Test"))
แปลง Text → Binary → Text
Power Query Formula:

=Text.FromBinary(Text.ToBinary("Test"))

Result:

Test

เข้ารหัส Base64
Binary.ToText(Text.ToBinary("Hello"), BinaryEncoding.Base64)
แปลง Text เป็น Binary แล้วเข้ารหัส Base64
Power Query Formula:

=Binary.ToText(Text.ToBinary("Hello"), BinaryEncoding.Base64)

Result:

SGVsbG8="

Resources & Related

Additional Notes

Text.ToBinary ใช้สำหรับแปลงข้อความเป็นค่า Binary โดยใช้การเข้ารหัส UTF-8 เป็นค่าเริ่มต้น รองรับการเข้ารหัส UTF-16 และ ASCII

Leave a Reply

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