Пример #1
0
        public static async Task <bool> WriteRangesAsync(this SheetsService service, string spreadsheet, IList <ValueRange> values)
        {
            var  hashset           = new HashSet <string>(values.Select(range => range.Range.GetSheetName()));
            bool hasRequiredSheets = await service.CreateSheetsAsync(spreadsheet, hashset);

            if (!hasRequiredSheets)
            {
                return(false);
            }

            var result = await service.Spreadsheets.Values.BatchUpdate(UpdateRequest(values), spreadsheet).AddBackOffHandler().ExecuteAsync();

            return(result.TotalUpdatedCells > 0);
        }