Getting "This action will increase the number of cells per sheet over the limit of 2,000,000 cells" when calling the sheet API

I use the Google Sheets V4 append API to insert data into a newly created worksheet. I am inserting data with 1000 rows and 1001 columns i.e. 1001000 cells.

String url = https://sheets.googleapis.com/v4/spreadsheets/<spreadSheetId>/values/<workSheetName>!A1:append?access_token=<accessToken>&valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS
    //CREATING THE REQUEST BODY
reqBody.put("range", <workSheetName>+"!A1");
reqBody.put("majorDimension", "ROWS");
reqBody.put("values", <values>);

I get 400 Bad Request with the message: "This action will increase the number of cells on the sheet over the limit of 2,000,000 cells."

I know that Google has 2 million cells per sheet, but I can’t find out why I get this exception, especially since I did not exceed the limit.

Any help on why this error may occur?

+4
source share

Source: https://habr.com/ru/post/1685580/


All Articles