GoogleSheets

Reading and Writing Data

Methods for reading ranges, writing data, and appending or inserting values into Google Sheets.

Methods for reading ranges, writing data, and appending or inserting values into Google Sheets.

WithReadRange sets the A1-notation range to read. SaveTo(out IGPALGrid<string>) exports the range to an in-memory grid. SaveTo(GPALFile) exports to a file. WithData sets the grid to write. WithWriteRange sets the destination range for writes. WriteToSheet writes the grid to the specified sheet. AppendToSheet appends the grid as new rows at the end. InsertAtCell, AppendToCell, and PrependToCell write a single value to a specific cell position.

Examples

GPAL Fluent: High-level fluent C# API

//WithWriteRange sets the top-left cell for write operations - GPAL expands the range to fit the grid dimensions. AppendToSheet always adds rows at the bottom of existing data.

// Read a range into a grid GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .WithSheet("Data") .WithReadRange("A1:D100") .SaveTo(out var grid); // Write a grid to a sheet GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .WithData(myGrid) .WithWriteRange("A1") .WriteToSheet("Results"); // Append rows to a sheet GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .WithData(newRowsGrid) .AppendToSheet("Log");