GoogleSheets

Sheet and Spreadsheet Management

Methods for creating, deleting, and renaming sheets, setting the spreadsheet title, and performing calculations.

Methods for creating, deleting, and renaming sheets, setting the spreadsheet title, and performing calculations.

CreateSheet adds a new worksheet with the specified name. DeleteSheet removes a worksheet by name or ID. SetSheetName renames a worksheet. SetSpreadsheetTitle changes the name of the entire spreadsheet file. CalculateSum computes the sum of numeric values in a range and returns it as an out string. CalculateCount counts the non-empty cells in a range. WithInsertPosition and WithInsertSeparator configure how InsertAtCell positions content within a cell.

Examples

GPAL Fluent: High-level fluent C# API

//DeleteSheet accepts either a sheet name string or a numeric sheet ID (not the spreadsheet ID). Use ListSheets to get the sheet IDs if working with a dynamically created spreadsheet.

// Create a new sheet GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .CreateSheet("NewReport"); // Rename a sheet GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .WithSheet("OldName") .SetSheetName("NewName"); // Calculate sum of a range string total; GPAL.GoogleSheets .WithCredentials(googleCreds) .WithSpreadsheet("spreadsheet-id") .WithSheet("Sales") .WithReadRange("D2:D200") .CalculateSum(out total);