Ejemplo n.º 1
0
        public async Task <List <DetailDataViewModel> > ReadAsync(SpreadsheetsResource.ValuesResource valuesResource)
        {
            Google.Apis.Sheets.v4.Data.ValueRange response = await valuesResource.Get(SpreadsheetId, ReadRange).ExecuteAsync();

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

            DetailData detail = new DetailData();

            if (values != null || values.Any())
            {
                //CABEÇALHO: var header = string.Join(" ", values.First().Select(r => r.ToString()));
                //foreach (var row in values.Skip(1))
                for (int i = 1; i < 4; i++)
                {
                    var row = values[i];
                    detail.Data.Add(new DetailDataViewModel
                    {
                        Id             = i,
                        CharName       = row[0].ToString(),
                        Type           = row[1].ToString(),
                        Skins          = row[2].ToString(),
                        Skin_Spotlight = row[3].ToString(),
                    });
                }
            }
            return(detail.Data);
        }
Ejemplo n.º 2
0
        private static async Task LerPlanilha(SpreadsheetsResource.ValuesResource valuesResource,
                                              string range, string idPlanilha, bool planilhaDiaria)
        {
            var response = await valuesResource.Get(idPlanilha, range).ExecuteAsync();

            var values = response.Values;

            if (planilhaDiaria)
            {
                EscreverRangeDiario = $"A{values.Count + 1}:J{values.Count}";
            }
            else
            {
                await EscreverPlanilhaDiaria(valuesResource, values);
            }
        }
        private static async Task ReadAsync(SpreadsheetsResource.ValuesResource valuesResource)
        {
            var response = await valuesResource.Get(SpreadsheetId, ReadRange).ExecuteAsync();

            var values = response.Values;

            if (values == null || !values.Any())
            {
                Console.WriteLine("No data found.");
                return;
            }

            var header = string.Join(" ", values.First().Select(r => r.ToString()));

            Console.WriteLine($"Header: {header}");

            foreach (var row in values.Skip(1))
            {
                var res = string.Join(" ", row.Select(r => r.ToString()));
                Console.WriteLine(res);
            }
        }