Skip to content Skip to sidebar Skip to footer

Copy Spreadsheet Sheet To A Another One With Google Api Using Python

I am trying to create a google spreadsheet from a template and then edit its values (cells). Manually, I just visit the original spreadsheet and click Make a copy from the File men

Solution 1:

How about a following modification?

I think that the error means that the structure of "destinationSpreadsheetId": "1d8CeUxukBIOUpADE6eBlaksS2ptBjI0vIRpVm8ufEbs" is wrong. When it sees the right side of the document of spreadsheets.sheets.copyTo, the request body is {"destinationSpreadsheetId": ""}. So please try a following modification.

From :

copy_sheet_to_another_spreadsheet_request_body = {
    {
  "destinationSpreadsheetId": "1d8CeUxukBIOUpADE6eBlaksS2ptBjI0vIRpVm8ufEbs"
}
}

To :

copy_sheet_to_another_spreadsheet_request_body = {
  "destinationSpreadsheetId": "1d8CeUxukBIOUpADE6eBlaksS2ptBjI0vIRpVm8ufEbs"
}

If I misunderstand your question, I'm sorry.

Edit :

For the next error, I confirmed following patterns.

  1. When the user who uses this script is the owner of the spreadsheet that you want to copy, of course, the script works fine.
  2. When the user who uses this script is NOT the owner of the spreadsheet that you want to copy,
    • If the spreadsheet is not shared, the error of "The caller does not have permission" occurred. This error may be the same to your situation.
    • If the spreadsheet is shared as On - Anyone with the link, the script works fine.

From above results, can you confirm the permission of the spreadsheet you want to copy again?


Post a Comment for "Copy Spreadsheet Sheet To A Another One With Google Api Using Python"