vue.jsgoogle-sheetsaxiosnuxt.jsstatic-pages

Api Sheets Problem Nuxt 2 when i try CopyTo


Problem

Hi guys. when I try to send this request I don't know why it doesn't work, I have Oauth2.0 I happen to use Nuxt2 and Nuxt/auth to make a static page. That's why axios sends this request but the response is the json down here.

google scopes https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive https://www.googleapis .com/auth/drive.file https://www.googleapis.com/auth/spreadsheets

The copy page exists and the paste page exists.

POST https://sheets.googleapis.com/v4/spreadsheets/${iDspreadsheet}/sheets/${id_sheet}:copyTo?key=your_key&access_token=your_access_token

Request body

{
    "destinationSpreadsheetId": "2068676742"
}

RESPONSE

{
    "error": {
        "code": 400,
        "message": "Invalid destinationSpreadsheetId [2068676742]",
        "status": "INVALID_ARGUMENT"
    }
}

thank you


Solution

  • From "destinationSpreadsheetId": "2068676742" of your request body and "message": "Invalid destinationSpreadsheetId [2068676742]" of your error message, I guessed that the value of 2068676742 might not be the destination Spreadsheet ID.

    If you actually used 2068676742 as the value of the destination Spreadsheet ID, I guess that from the length of the value, you might have used the sheet ID.

    If my understanding is correct, please use the Spreadsheet ID of the destination Spreadsheet, and test it again.

    Reference: