Skip to main content
Version: Streamsheets 3.0

PROTOBUF.ENCODE

Premium

Encodes a Protobuf message. When using Docker, mount the Protobuf file before using it. For a Protobuf file called sparkplug_b.proto this might look like this in the volumes section of your docker-compose.yml: - ./sparkplug_b.proto:/protobuf/sparkplug_b.proto

Syntax

=PROTOBUF.ENCODE(Message, MessageType, ProtobufFile, [Target])

Arguments

NameTypeDescription
MessageStringThe message to encode
MessageTypeStringThe message type to use for encoding
ProtobufFileStringPath to the Protobuf file. When using Docker, the file has to be mounted into the container before using it here.
Target (optional)TargetThe target where to write the encoded Protobuf message to

Return

The encoded Protobuf message

Examples

For this example to work, the file "sparkplug_b.proto" must be located in the "/protobuf" directory.

FormulaResultComment
=PROTOBUF.ENCODE(JSON(A1:B2),"Payload", "/protobuf/sparkplug_b.proto")
The encoded messageEncode the JSON in A1:B2 using the Sparkplug B Protobuf file and return the encoded message