C# SDK to simplify connecting to the Smartsheet API from .NET applications.
The SDK supports C# version 4.0 or later and targets .NET 6.0.
To add the SDK to a .Net project
dotnet add package smartsheet-csharp-sdk
To call the API, you will need an access token, which looks something like this example: ll352u9jujauoqz4gstvsae05. You can find the access token in the UI at Account > Personal Settings > API Access.
The following is a brief sample that shows you how to:
- Initialize the client
- List all sheets
- Load one sheet
using Smartsheet.Api;
using Smartsheet.Api.Models;
static void Sample()
{
SmartsheetClient smartsheet = new SmartsheetBuilder()
// TODO: Set your API access in environment variable SMARTSHEET_ACCESS_TOKEN or else here
// .SetAccessToken("JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789")
.Build();
PaginatedResult<Sheet> sheets = smartsheet.SheetResources.ListSheets(null, null, null);
Console.WriteLine("Found " + sheets.TotalCount + " sheets");
long sheetId = (long) sheets.Data[0].Id;
Console.WriteLine("Loading sheet id: " + sheetId);
var sheet = smartsheet.SheetResources.GetSheet(sheetId);
Console.WriteLine("Loaded " + sheet.Rows.Count + " rows from sheet: " + sheet.Name);
}
A simple, but complete sample application project is here: https://github.com/smartsheet-samples/csharp-read-write-sheet
For details about logging, testing, how to use a passthrough option, and how to override HTTP client behavior, see Advanced Topics.
The full Smartsheet API documentation is here: https://smartsheet.redoc.ly.
The generated SDK class documentation is here: https://smartsheet.github.io/smartsheet-csharp-sdk/api/index.html.
All releases and release notes are available on Github or the NuGet repository.
Review the Developer Program Agreement.
We would like to thank the following people for their contributions to this project:
- Eric Yang - ericyan1
- Tim Wells - timwellswa
- Kevin Fansler - kfansler
- Brett Batie - brettbatie
- Steve Weil - seweil