CSV To Protocol Buffers

Login

Email
Password

Don't have an account yet?

Go to Sign up

{{ workbook ? 'Online Table Editor' : 'Input Data' }}
Change File Enter Data
Row Col Row Col
Transpose Clear Delete Empty Deduplicate
ABC abc Abc
Replace
First Row as Header
{{ displayRows.length }} rows x {{ displayHeaders.length }} columns{{ firstRowAsHeader ? ' (1 header)' : '' }} {{ selectedRows.length > 0 ? selectedRows.length + ' selected' : '' }}
Output Data
{{ copied ? 'Copied!' : 'Copy to Clipboard' }} Download File
Properties
Convert CSV to Protocol Buffers online — paste, edit, and download Protobuf.

Convert Restart
Insert Row Below
Insert Row Above
Insert Column Right
Insert Column Left
Delete Row {{ contextMenu.row + 1 }}
Delete Column {{ contextMenu.col + 1 }}
Clear Cell
Clear Row
Case sensitive Use regex Cancel Replace All

CSV to Protocol Buffers Converter — Free Online .proto Schema Generator

What Are Protocol Buffers?

Protocol Buffers (Protobuf) is a language-neutral, platform-neutral serialization format developed by Google. It defines structured data schemas in .proto files, then generates code for 15+ languages.

syntax = "proto3";

package example;

message Person {

 string name  = 1;

 int32  age   = 2;

 string email = 3;

}

Why Protocol Buffers?

AdvantageDescription
CompactBinary format — 3-10x smaller than JSON
FastSerialization/deserialization faster than JSON/XML
TypedStrong typing with schema validation
Cross-languageGenerate code for Java, Python, Go, C++, C#, JS, Ruby, PHP, Rust, Swift, Kotlin, Dart, and more
EvolvableAdd new fields without breaking old code
Schema-firstContract between services defined upfront

Who Uses Protocol Buffers?

OrganizationUse Case
GoogleInternal RPC, data storage, APIs
gRPCDefault serialization format for all gRPC services
KubernetesAPI definitions (api.proto, meta.proto)
TensorFlowModel definitions (tensorflow/core/framework/*.proto)
EnvoyConfiguration and xDS protocol
LyftService communication via gRPC
NetflixEdge communication
SquarePayment processing
CoinbaseFinancial data exchange
Cortana (Microsoft)Voice assistant data

Proto2 vs Proto3

Featureproto2proto3
Syntaxsyntax = "proto2";syntax = "proto3";
Field presenceExplicit (optional, required)All fields implicitly optional
Default valuesNo default encodingFields with default values not serialized
EnumsOpen (first value can be anything)First value must be 0
ExtensionsSupportedReplaced by Any
JSON mappingLimitedBuilt-in support
MapsSupportedSupported
RecommendationLegacy systems onlyDefault choice for new projects

.proto File Structure

syntax = "proto3";           // Required: proto version

package myapp.v1;            // Namespace

option java_package = "com.example.myapp.v1";

option go_package = "github.com/example/myapp/v1";

message User {               // Message definition

 int32  id       = 1;       // Field: type, name, field number

 string name     = 2;

 string email    = 3;

 bool   active   = 4;

 double balance  = 5;

}

enum Status {                // Enum definition

 UNKNOWN   = 0;

 ACTIVE    = 1;

 SUSPENDED = 2;

}

Protobuf Scalar Types

TypeDescriptionDefault
double64-bit floating point0.0
float32-bit floating point0.0
int32Variable-length int (negative inefficient)0
int64Variable-length int640
sint32Zigzag encoding (efficient negatives)0
sint64Zigzag encoding (efficient negatives)0
uint32Unsigned int320
uint64Unsigned int640
fixed32Fixed 4 bytes (efficient > 2^28)0
fixed64Fixed 8 bytes0
sfixed32Signed fixed 4 bytes0
sfixed64Signed fixed 8 bytes0
boolBooleanfalse
stringUTF-8 text""
bytesArbitrary bytesempty

CSV-to-Protobuf Type Inference

Since CSV is all text, the tool infers protobuf types from values:

CSV Value PatternInferred Protobuf TypeExample
Integer (42, -7)int32int32 age = 1;
Large integerint64int64 timestamp = 2;
Decimal (3.14)doubledouble price = 3;
true / falseboolbool active = 4;
Any other textstringstring name = 5;
Empty / mixedstringstring value = 6;

Field Number Assignment

Field numbers are assigned sequentially starting from 1, matching column order in the CSV.

Why Convert CSV to Protobuf Schema?

Use CaseDescription
API migrationDefine protobuf schemas from existing CSV data exports
gRPC servicesGenerate .proto files for new gRPC endpoints
Data pipeline designDesign schemas for Kafka + Protobuf pipelines
Kubernetes CRDsDefine custom resource structures
Legacy data migrationConvert CSV exports to typed protobuf messages
DocumentationGenerate schema docs from sample data
Schema prototypingQuickly draft .proto from real data
Database exportConvert SQL CSV dumps to protobuf definitions

Core Features

1. Online Table Editor

After loading CSV data, an interactive spreadsheet grid lets you edit before converting:

OperationDescription
TransposeSwap rows and columns
ClearRemove all data
Delete EmptyRemove empty rows/columns
DeduplicateRemove duplicate rows
ReplaceFind and replace (with regex support)
Case transformUPPERCASE, lowercase, Title Case
Insert/deleteRight-click for row/column operations
First Row as HeaderToggle header treatment

2. Automatic Type Inference

The tool analyzes CSV cell values and infers the correct protobuf scalar type:

  • Numeric-only columns → int32 or double

  • Boolean columns → bool

  • Text columns → string

3. Privacy by Design

All processing runs entirely in your browser. No CSV data is uploaded to any server.

How to Use

Step 1: Load CSV Data

Choose one of two input methods:

  • Upload a file: Click "Choose File" and select a .csv file.

  • Paste data: Click "Enter Data" to switch to the code editor. Paste your CSV.

Step 2: Edit in Table Editor (Optional)

Use the toolbar to clean your data before converting. Remove empty rows, deduplicate, fix casing.

Step 3: Enable "First Row as Header"

Toggle this ON to use the first CSV row as field names in the generated .proto message.

Step 4: Convert

Click Convert. The .proto schema appears in the "Output Data" panel.

Step 5: Copy or Download

  • Click Copy to Clipboard to paste into your .proto file.

  • Premium users can click Download File to save.

Complete Example — User Data

Input CSV:

id,name,email,age,active,balance

1,Alice,[email protected],30,true,1250.50

2,Bob,[email protected],25,false,0.00

3,Charlie,[email protected],35,true,9800.75

Output .proto:

syntax = "proto3";

message Record {

 int32  id      = 1;

 string name    = 2;

 string email   = 3;

 int32  age     = 4;

 bool   active  = 5;

 double balance = 6;

}

Example — Sensor Readings

Input CSV:

sensor_id,timestamp,temperature,humidity,location

SENS-01,1714953600,22.5,45.2,Warehouse-A

SENS-02,1714953600,18.3,62.1,Warehouse-B

SENS-03,1714953600,25.0,38.7,Warehouse-A

Output .proto:

syntax = "proto3";

message Record {

 string sensor_id    = 1;

 int64  timestamp    = 2;

 double temperature  = 3;

 double humidity     = 4;

 string location     = 5;

}

Example — Product Catalog

Input CSV:

sku,name,category,price,in_stock,weight_kg

SKU-1001,Wireless Mouse,Electronics,29.99,true,0.08

SKU-1002,Mechanical Keyboard,Electronics,149.99,true,0.85

SKU-1003,USB-C Cable,Accessories,12.99,true,0.05

SKU-1004,Monitor Stand,Furniture,79.99,false,3.20

Output .proto:

syntax = "proto3";

message Record {

 string sku         = 1;

 string name        = 2;

 string category    = 3;

 double price       = 4;

 bool   in_stock    = 5;

 double weight_kg   = 6;

}

Using the Generated .proto File

Python

pip install grpcio-tools

python -m grpc_tools.protoc --python_out=. --proto_path=. data.proto


import data_pb2

record = data_pb2.Record(

   id=1,

   name="Alice",

   email="[email protected]",

   age=30,

   active=True,

   balance=1250.50

)

serialized = record.SerializeToString()

print(f"Serialized: {len(serialized)} bytes")


new_record = data_pb2.Record()

new_record.ParseFromString(serialized)

print(new_record.name)

Go

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

protoc --go_out=. data.proto

package main

import (

   "fmt"

   "google.golang.org/protobuf/proto"

   pb "yourmodule/data"

)

func main() {

   record := &pb.Record{

       Id:      1,

       Name:    "Alice",

       Email:   "[email protected]",

       Age:     30,

       Active:  true,

       Balance: 1250.50,

   }

   data, _ := proto.Marshal(record)

   fmt.Printf("Serialized: %d bytes\n", len(data)

   )

}

Java

<dependency>

   <groupId>com.google.protobuf</groupId>

   <artifactId>protobuf-java</artifactId>

   <version>4.29.3</version>

</dependency>

protoc --java_out=src/main/java data.proto

Record record = Record.newBuilder()

   .setId(1).setName("Alice")

   .setEmail("[email protected]")

   .setAge(30)

   .setActive(true)

   .setBalance(1250.50)

   .build();

byte[] data = record.toByteArray();

System.out.println("Serialized: " + data.length + " bytes");

Node.js / TypeScript

npm install google-protobuf

npx pbjs -t static-module -w commonjs -o data.js data.proto

npx pbts -o data.d.ts data.js

const messages = require("./data.js");

const record = messages.Record.create({

   id: 1,

   name: "Alice",

   email: "[email protected]",

   age: 30,

   active: true,

   balance: 1250.50,

});

const buffer = messages.Record.encode(record).finish();

console.log(`Serialized: ${buffer.length} bytes`);

const decoded = messages.Record.decode(buffer);

console.log(decoded.name);

Protocol Buffers vs JSON vs XML

AspectProtobufJSONXML
FormatBinaryTextText
SchemaRequired (.proto)Optional (JSON Schema)Optional (XSD)
SizeSmallestMediumLargest
SpeedFastestMediumSlowest
Human-readableNo (binary)YesYes
Type safetyStrongWeakWeak
Code generationBuilt-inExternal toolsExternal tools
Field evolutionBuilt-in rulesManualManual
Best forRPC, microservicesAPIs, web, configDocuments, legacy

Protobuf in the gRPC Ecosystem

gRPC uses Protocol Buffers as its Interface Definition Language (IDL) and message format:

syntax = "proto3";

package users.v1;

service UserService {

 rpc GetUser(GetUserRequest) returns (GetUserResponse);

 rpc ListUsers(ListUsersRequest) returns (stream GetUserResponse);

 rpc CreateUser(CreateUserRequest) returns (GetUserResponse);

}

message GetUserRequest {

 int32 id = 1;

}

message GetUserResponse {

 int32  id      = 1;

 string name    = 2;

 string email   = 3;

 int32  age     = 4;

 bool   active  = 5;

 double balance = 6;

}

message ListUsersRequest {

 int32 page_size = 1;

 string page_token = 2;

}

message CreateUserRequest {

 string name    = 1;

 string email   = 2;

 int32  age     = 3;

}

CSV ColumnProtobuf FieldNotes
User Nameuser_nameLowercase with underscores
firstNamefirst_nameConvert camelCase to snake_case
IDidLowercase
Price (USD)price_usdRemove special chars
IsActiveis_activeLowercase with underscores
created_atcreated_atAlready correct

Protobuf style guide recommends lowercase_with_underscores for field names.

Frequently Asked Questions

  • Does the tool upload my data?

    No. All conversion happens locally in your browser using JavaScript. Your CSV data never leaves your device.

  • What is Protocol Buffers?

    Protocol Buffers (Protobuf) is Google's language-neutral serialization format. You define data structures in .proto files, then generate typed code for 15+ programming languages. It is the default format for gRPC.

  • What is the difference between proto2 and proto3?

    proto3 is the current default. It has simpler syntax, no required fields, and built-in JSON mapping. proto2 supports required/optional field modifiers and extensions. Use proto3 for new projects.

  • How does the tool infer protobuf types from CSV?

    The tool analyzes cell values in each column. Columns with only integers become int32, decimals become double, true/false becomes bool, and everything else becomes string. Large integers may be inferred as int64.

  • Can I edit the generated .proto file?

    Yes. Copy the output and modify it. Add package, option, enum, service, repeated fields, oneof, map, and nested messages as needed.

  • What happens with empty CSV cells?

    Empty cells are treated as the default value for their inferred type. The field is still included in the message definition.

  • Can I use this for gRPC service definitions?

    The tool generates message definitions. To create a full gRPC service, add service blocks with rpc methods manually, using the generated messages as request/response types.

  • What CSV formats are supported?

    Standard CSV with comma delimiters. Enable "First Row as Header" to use column names as protobuf field names.

  • How do I compile the .proto file?

    Use protoc (the Protocol Buffer compiler):

    # Python protoc --python_out=. data.proto # Go protoc --go_out=. data.proto # Java protoc --java_out=src/main/java data.proto # C++ protoc --cpp_out=. data.proto # C# protoc --csharp_out=. data.proto
  • Is there a file size limit?

  • The tool processes data entirely in your browser. Files up to 10 MB typically convert without issues on modern hardware.

Featured Tools

Featured tools that you might find useful.

Popular Tools

List of popular tools that users love and frequently use.

New Tools

The latest tools added to our collection, designed for you.

Topics

The tools grouped by topics to quickly find what you need.
Free online Excel to JSON converter. Transform XLSX, XLS, XLSM files into JSON arrays, objects, or keyed formats instantly in your browser — no upload, 100% private.

Excel To JSON

Free online Excel to JSON converter. Transform XLSX, XLS, XLSM files into JSON arrays, objects, or keyed formats instantly in your browser — no upload, 100% private.
Free Excel to CSV converter. Convert XLSX, XLS, XLSM to CSV instantly in your browser. No upload, 100% private. Edit, transpose, deduplicate before exporting.

Excel To CSV

Free Excel to CSV converter. Convert XLSX, XLS, XLSM to CSV instantly in your browser. No upload, 100% private. Edit, transpose, deduplicate before exporting.
Free online Excel to SQL converter. Generate CREATE TABLE and INSERT statements from spreadsheets for MySQL, PostgreSQL, SQLite, and SQL Server. Supports batch insert, primary keys, and type inference.

Excel To SQL

Free online Excel to SQL converter. Generate CREATE TABLE and INSERT statements from spreadsheets for MySQL, PostgreSQL, SQLite, and SQL Server. Supports batch insert, primary keys, and type inference.
Free online Excel to ASCII table converter with 10 border styles (MySQL, Unicode, reStructuredText, and more). Add code comment wrappers in 8 languages. Supports text alignment. Client-side processing.

Excel To ASCII Table

Free online Excel to ASCII table converter with 10 border styles (MySQL, Unicode, reStructuredText, and more). Add code comment wrappers in 8 languages. Supports text alignment. Client-side processing.