Skip to content

Make Worksheet#copy_to and Worksheet#duplicate returns copied Worksheet#414

Open
tomocrafter wants to merge 1 commit intogimite:masterfrom
tomocrafter:patch-1
Open

Make Worksheet#copy_to and Worksheet#duplicate returns copied Worksheet#414
tomocrafter wants to merge 1 commit intogimite:masterfrom
tomocrafter:patch-1

Conversation

@tomocrafter
Copy link

No description provided.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants