Recent Comments

Archives

Categories

Meta

Google Sheets API (v4) and C# – Updating Cells

Writing an application in C# and interacting with the Google Sheets API?

We’ve found information on that can be an unfortunately hit or miss kind of situation out there – so we thought we’d share a little bit of what we’ve found to work quite well. In our example we’re going to assume you just want to update a particular cell, on a Google Sheet you’ve created.

Google actually does a really nice job of giving us a .NET Quickstart Guide but in some cases you want to do a little more – and if you’re new to C# or .NET development you might be scratching your head going “okay, where do I go from here?”

Well, with this example below, you can see pretty clearly how to go about creating something that will update a cell on a Google Sheet.

.RAW means the values the user has entered will not be parsed and will be stored as-is. So if your value is “=SUM(A1:A3)”, it will be displayed exactly like that – it will not convert it to a formula.

.USER_ENTERED means the values will be parsed as if the user typed them into the UI. Numbers will stay as numbers, but strings may be converted to numbers, dates, etc. following the same rules that are applied when entering text into a cell via the Google Sheets UI. If you have forumula’s and stuff that you want converted – this would be the option for you.

This kind of gives you a rough ‘bare bones’ example of how you can interact with Google Sheets API v4 within a C# environment – specifically with regards to adding/changing cells on a particular spreadsheet.

If you have other cool snippets you’d like to share – show us in the comments!