Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/google_drive/worksheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I just happened to look at this PR and noticed something that might be causing issues.
I tried running it locally and it seems like the second argument to Worksheet.new needs to be the destination spreadsheet — otherwise it throws an error when accessing the copied worksheet.

For example, this worked for me:

response = @session.sheets_service.copy_spreadsheet(spreadsheet.id, sheet_id, request)
dest_spreadsheet = @session.spreadsheet_by_key(destination_spreadsheet_id)
Worksheet.new(@session, dest_spreadsheet, response)

Not sure if this is still relevant after all this time, but thought I’d share just in case!


# Copy worksheet to owner spreadsheet.
Expand Down