GoogleSheetsWrapper 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package GoogleSheetsWrapper --version 1.0.0
                    
NuGet\Install-Package GoogleSheetsWrapper -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GoogleSheetsWrapper" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GoogleSheetsWrapper" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="GoogleSheetsWrapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GoogleSheetsWrapper --version 1.0.0
                    
#r "nuget: GoogleSheetsWrapper, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GoogleSheetsWrapper@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GoogleSheetsWrapper&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=GoogleSheetsWrapper&version=1.0.0
                    
Install as a Cake Tool

GoogleSheetsWrapper

Google Sheets API .NET Wrapper Library

This library allows you to use strongly typed objects against a Google Sheets spreadsheet without having to have knowledge on the Google Sheets API methods and formats.

Most Google Sheets API operations including

  • Reading all rows
  • Appending new rows
  • Deleting rows
  • Updating specific cells

Are encapsulated in the SheetsHelper class. There are also base classes, BaseRecord and BaseRepository to simply transforming raw Google Sheets rows into .NET objects.

Extending the BaseRecord class you can decorate properties with the SheetFieldAttribute to describe the column header name, the column index (1 based index and not 0 based index)

public class TestRecord : BaseRecord
{
    [SheetField(
        DisplayName = "Name",
        ColumnID = 1,
        FieldType = SheetFieldType.String)]
    public string Name { get; set; }

    [SheetField(
        DisplayName = "Number",
        ColumnID = 2,
        FieldType = SheetFieldType.PhoneNumber)]
    public long PhoneNumber { get; set; }

    [SheetField(
        DisplayName = "Previous Donation Amount",
        ColumnID = 3,
        FieldType = SheetFieldType.Currency)]
    public double DonationAmount { get; set; }

    public TestRecord() { }

    public TestRecord(IList<object> row, int rowId) : base(row, rowId) { }
}

Extending the BaseRepository allows you to define your own access layer to the Google Sheets tab you want to work with.

public class TestRepository : BaseRepository<TestRecord>
{
    public TestRepository() { }

    public TestRepository(SheetHelper<TestRecord> sheetsHelper)
        : base(sheetsHelper) { }
}

Using the Google Sheets Wrapper library.

Note that to do this you will need to setup a Google Service Account and create a service account key. More details can be found here: https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys

// You need to implement your own configuration management solution here!
var settings = AppSettings.FromEnvironment();

// Create a SheetHelper class for the specified Google Sheet and Tab name
var sheetHelper = new SheetHelper<TestRecord>(
    settings.GoogleSpreadsheetId,
    settings.GoogleServiceAccountName,
    settings.GoogleMainSheetName);

sheetHelper.Init(settings.JsonCredential);

// Create a Repository for the TestRecord class
var repository = new TestRepository(sheetHelper);

// Get all rows from the Google Sheet
var allRecords = repository.GetAllRecords();

// Get the first record
var firstRecord = allRecords.First();

// Update the DonationAmount field and save it back to Google Sheets
firstRecord.DonationAmount = 99.99;
repository.SaveField(firstRecord, (r) => r.DonationAmount);

// Delete the first record from Google Sheets
repository.DeleteRecord(firstRecord);

// Add a new record to the end of the Google Sheets tab
repository.AddRecord(new TestRecord()
{
    Name = "John",
    Number = 2021112222,
    DonationAmount = 250.50,
    Date = DateTime.Now()
});

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.26 1,306 8/12/2025
2.0.25 1,001 5/10/2025
2.0.24 9,865 1/4/2025
2.0.23 409 12/13/2024
2.0.22 1,437 10/31/2024
2.0.21 183 10/31/2024
2.0.20 515 9/28/2024
2.0.19 171 9/28/2024
2.0.18 447 8/19/2024
2.0.17 100,980 7/20/2024
2.0.16 250 6/8/2024
2.0.15 240 6/3/2024
2.0.14 195 6/3/2024
2.0.13 210 5/29/2024
2.0.12 232 5/29/2024
2.0.11 537 1/20/2024
2.0.10 202 1/20/2024
2.0.9 7,878 1/8/2024
2.0.8 224 1/6/2024
2.0.7 202 1/6/2024
2.0.6 359 12/19/2023
2.0.5 350 11/28/2023
2.0.4 390 11/26/2023
2.0.3 184 11/25/2023
2.0.2 215 11/14/2023
2.0.1 166 11/14/2023
2.0.0 166 11/13/2023
1.0.58 23,250 11/13/2023
1.0.57 221 11/6/2023
1.0.56 192 11/6/2023
1.0.55 248 10/21/2023
1.0.54 1,908 5/9/2023
1.0.53 263 5/6/2023
1.0.52 48,884 2/7/2023
1.0.51 2,259 1/1/2023
1.0.50 391 12/29/2022
1.0.49 415 11/28/2022
1.0.48 428 11/28/2022
1.0.47 421 11/28/2022
1.0.46 410 11/28/2022
1.0.45 423 11/28/2022
1.0.44 451 11/22/2022
1.0.43 453 11/22/2022
1.0.42 416 11/22/2022
1.0.41 441 11/22/2022
1.0.40 459 11/22/2022
1.0.39 712 11/20/2022
1.0.38 442 11/19/2022
1.0.37 1,964 8/25/2022
1.0.36 544 8/18/2022
1.0.35 615 8/2/2022
1.0.34 544 6/18/2022
1.0.33 647 5/19/2022
1.0.32 548 5/17/2022
1.0.31 788 3/8/2022
1.0.30 573 3/8/2022
1.0.29 590 1/19/2022
1.0.28 442 12/20/2021
1.0.27 594 10/31/2021
1.0.26 441 10/28/2021
1.0.25 440 10/26/2021
1.0.24 469 10/17/2021
1.0.23 518 10/17/2021
1.0.22 487 10/16/2021
1.0.21 569 9/12/2021
1.0.20 539 8/26/2021
1.0.19 489 8/25/2021
1.0.18 456 8/25/2021
1.0.17 461 8/22/2021
1.0.16 471 8/22/2021
1.0.15 462 8/22/2021
1.0.14 487 8/21/2021
1.0.13 481 8/21/2021
1.0.12 473 8/21/2021
1.0.11 431 8/21/2021
1.0.10 456 8/21/2021
1.0.9 459 8/11/2021
1.0.8 447 8/9/2021
1.0.7 442 8/9/2021
1.0.6 501 8/8/2021
1.0.5 452 8/6/2021
1.0.4 510 8/5/2021
1.0.3 494 8/3/2021
1.0.2 505 8/3/2021
1.0.1 539 8/1/2021
1.0.0 449 8/1/2021