コード例 #1
0
        internal async Task <bool> DeleteRow(string guid)
        {
            bool success;
            Cell deleteCell = await QueryGuidExists(guid);

            if (!deleteCell.Equals(Cell.InvalidCell))
            {
                Request requestBody = new Request()
                {
                    DeleteDimension = new DeleteDimensionRequest()
                    {
                        Range = new DimensionRange()
                        {
                            SheetId    = 0,
                            Dimension  = "ROWS",
                            StartIndex = deleteCell.Row - 1,
                            EndIndex   = deleteCell.Row
                        }
                    }
                };

                List <Request> requestContainer = new List <Request>();
                requestContainer.Add(requestBody);

                BatchUpdateSpreadsheetRequest deleteRequest = new BatchUpdateSpreadsheetRequest();
                deleteRequest.Requests = requestContainer;

                BatchUpdateRequest deletion = new BatchUpdateRequest(SheetsService, deleteRequest, SpreadsheetId);
                await deletion.ExecuteAsync();

                success = true;
            }
            else
            {
                success = false;
            }

            return(success);
        }
コード例 #2
0
        // STATUS [ August 3, 2019 ] : this works
        // BatchUpdateValuesResponse
        //  * "The response when updating a range of values in a spreadsheet"
        //  * Type is Google.Apis.Sheets.v4.Data.BatchUpdateValuesResponse
        //  * To do this async --> Data.BatchUpdateValuesResponse response = await request.ExecuteAsync();
        //  * See: https://bit.ly/2ZG0VJq
        private async static Task <BatchUpdateValuesResponse> CreateBatchUpdateValuesResponseAsync(BatchUpdateRequest request)
        {
            BatchUpdateValuesResponse response = await request.ExecuteAsync().ConfigureAwait(false);

            return(response);
        }