jeudi 30 avril 2020

How to use if em google spreadsheet in c#

I am working on a google spreadsheet in conjunction with C #, I was able to make the connection and read the data from the spreadsheet but I am facing problems when making a comparison for a decision making using if

 String Range = "D1!A1:A1";

        SpreadsheetsResource.ValuesResource.GetRequest request = service.Spreadsheets.Values.Get(SpreadSheetId, Range);
        var response = request.Execute();

         IList < IList < Object >> values = response.Values;

        if(values != null && values.Count > 0){    
           foreach (var row in values)
            {
                Console.WriteLine(row[0]);
                if (row[0] == "Test")
                {
                    Console.WriteLine("Has Test string in spreadSheet!");
                }
            }

        }else{
            Console.WriteLine("Nothing");

        }

EDIT: looks like using Equals this is work but not properly i need

Aucun commentaire:

Enregistrer un commentaire