From bcbec2a00d4c15ef596fcbf9f1a8fe5774e25215 Mon Sep 17 00:00:00 2001 From: tomotomo Date: Fri, 22 Oct 2021 16:26:05 +0900 Subject: [PATCH] Make Worksheet#copy_to and Worksheet#duplicate returns copied Worksheet --- lib/google_drive/worksheet.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/google_drive/worksheet.rb b/lib/google_drive/worksheet.rb index b461630f..71973184 100644 --- a/lib/google_drive/worksheet.rb +++ b/lib/google_drive/worksheet.rb @@ -151,8 +151,8 @@ def copy_to(spreadsheet_or_id) request = Google::Apis::SheetsV4::CopySheetToAnotherSpreadsheetRequest.new( destination_spreadsheet_id: destination_spreadsheet_id, ) - @session.sheets_service.copy_spreadsheet(spreadsheet.id, sheet_id, request) - nil + response = @session.sheets_service.copy_spreadsheet(spreadsheet.id, sheet_id, request) + Worksheet.new(@session, spreadsheet, response) end # Copy worksheet to owner spreadsheet.