GoogleSheetsService 1.1.0
dotnet add package GoogleSheetsService --version 1.1.0
NuGet\Install-Package GoogleSheetsService -Version 1.1.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="GoogleSheetsService" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GoogleSheetsService" Version="1.1.0" />
<PackageReference Include="GoogleSheetsService" />
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 GoogleSheetsService --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GoogleSheetsService, 1.1.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 GoogleSheetsService@1.1.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=GoogleSheetsService&version=1.1.0
#tool nuget:?package=GoogleSheetsService&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
googlesheets-service
Simple service to read and write to google sheets using Google.Apis.Sheets.v4
How to setup:
- Create a google cloud project.
- Enable Google sheets API for the project
- Create a service account
- Create a key for the service account and download as JSON
- Set environment variable
GOOGLE_APPLICATION_CREDENTIALSto the path of the JSON file -
- Copy the email of the service account → go to the google sheets you want to use → share this sheets with the service account email
Usage example:
Read:
// See https://aka.ms/new-console-template for more information
using GoogletSheetsService;
using Newtonsoft.Json;
using System;
var sheetsService = new GoogleSheetsService();
// Read data from the sheet
// How to get sheet id: https://developers.google.com/sheets/api/guides/concepts
var spreadsheetId = "<your sheet ID>";
var sheetName = "Sheet1";
var range = "A2:B2";
var data = await sheetsService.ReadSheetAsync(spreadsheetId, sheetName, range);
var json = JsonConvert.SerializeObject(data);
Console.WriteLine(json);
Write:
// Write data
var values = new List<IList<object>>
{
new List<object> { "Name", "Age" },
new List<object> { "Alice", 25 },
new List<object> { "Bob", 30 }
};
await sheetsService.WriteSheetAsync(spreadsheetId, sheetName, "A1:B3", values);
Write at last empty row:
// Create a list of lists of objects to write to the sheet
var people = new List<Person>
{
new Person ( "Alice", 25, "123 Main St" ),
new Person ("Bob", 30, "456 Oak Ave"),
new Person ("Another Person", 30, "456 Oak Ave")
};
// Convert the list of Person objects to an IList<IList<object>> using reflection
var values = people.ToGoogleSheetsValues();
await sheetsService.WriteSheetAtLastRowAsync(spreadsheetId, sheetName, values);
public record Person(string Name, int Age, string Address);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Google.Apis.Sheets.v4 (>= 1.60.0.2979)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.