0

So, i've made an application that fetches data from Spreadsheet with a rest api call. This data is being mapped from the ValueRange object to a list of custom object and cached in the application for 10 minutes.

I'd like to be able to update a single cell of a specified row of which I do not know the range value (for example 'E9') of.

Is there a good way to loop through the items in the spreadsheet and update a cell value where another field value matches?!

public static void UpdateQuantity(string nameToMatch, int quantity)
{
    // find row where column A matches nameToMatch
    // update value of column B with quantity
    // finally clear cache to get the new data
    CacheHelper.ClearCache();
}

If else, when iterating through rows in spreadsheet, how do I know the current row number so I would do a REST call to update the specific cell?

Thanks in advance.

Jonas
  • 30
  • 4
  • 1
    Have you tried looking at the solution [here](https://stackoverflow.com/questions/49161249/google-sheets-api-how-to-find-a-row-by-value-and-update-its-content)? Also have you checked the documentation for other functions you needed? Reference: [Reading & Writing Cell Values](https://developers.google.com/sheets/api/guides/values) & [Method: spreadsheets.values.clear](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear). – MαπμQμαπkγVπ.0 May 03 '18 at 10:36
  • WOW - did not see that thread - and I Googled really hard ;) This seems like a good thing to try. Thanks! – Jonas May 04 '18 at 12:10
  • Does the link helpful? – MαπμQμαπkγVπ.0 May 07 '18 at 03:39

0 Answers0