diff --git a/tests/cassettes/WorksheetTest.test_get_values_merge_cells_with_named_range.json b/tests/cassettes/WorksheetTest.test_get_values_merge_cells_with_named_range.json new file mode 100644 index 000000000..dcf754c58 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_get_values_merge_cells_with_named_range.json @@ -0,0 +1,922 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_get_values_merge_cells_with_named_range\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "130" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Pragma": [ + "no-cache" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:30 GMT" + ], + "Vary": [ + "Origin, X-Origin" + ], + "content-length": [ + "217" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"name\": \"Test WorksheetTest test_get_values_merge_cells_with_named_range\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:30 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "3361" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_values_merge_cells_with_named_range\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:31 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "3361" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_values_merge_cells_with_named_range\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:32 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY:batchUpdate", + "body": "{\"requests\": [{\"updateSheetProperties\": {\"properties\": {\"sheetId\": 0, \"gridProperties\": {\"rowCount\": 4, \"columnCount\": 3}}, \"fields\": \"gridProperties/rowCount,gridProperties/columnCount\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "190" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:32 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/values/%27Sheet1%27%21A1%3AC4?valueInputOption=RAW", + "body": "{\"values\": [[\"1\", \"2\", \"4\"], [\"down\", \"up\", \"\"], [\"\", \"\", \"2\"], [\"num\", \"val\", \"\"]]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "84" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:32 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"updatedRange\": \"Sheet1!A1:C4\",\n \"updatedRows\": 4,\n \"updatedColumns\": 3,\n \"updatedCells\": 12\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY:batchUpdate", + "body": "{\"requests\": [{\"mergeCells\": {\"mergeType\": \"MERGE_ALL\", \"range\": {\"startRowIndex\": 1, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 1, \"sheetId\": 0}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "165" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:33 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY:batchUpdate", + "body": "{\"requests\": [{\"mergeCells\": {\"mergeType\": \"MERGE_ALL\", \"range\": {\"startRowIndex\": 0, \"endRowIndex\": 2, \"startColumnIndex\": 2, \"endColumnIndex\": 3, \"sheetId\": 0}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "165" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:34 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY:batchUpdate", + "body": "{\"requests\": [{\"addNamedRange\": {\"namedRange\": {\"name\": \"NamedRange\", \"range\": {\"startRowIndex\": 0, \"endRowIndex\": 3, \"startColumnIndex\": 1, \"endColumnIndex\": 3, \"sheetId\": 0}}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "180" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:35 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "403" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"replies\": [\n {\n \"addNamedRange\": {\n \"namedRange\": {\n \"namedRangeId\": \"1827042098\",\n \"name\": \"NamedRange\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 1,\n \"endColumnIndex\": 3\n }\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/values/%27Sheet1%27%21NamedRange", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:36 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "167" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!B1:C3\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"2\",\n \"4\"\n ],\n [\n \"up\"\n ],\n [\n \"\",\n \"2\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:36 GMT" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "content-length": [ + "3905" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_values_merge_cells_with_named_range\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 4,\n \"columnCount\": 3\n }\n },\n \"merges\": [\n {\n \"startRowIndex\": 1,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 1\n },\n {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 2,\n \"endColumnIndex\": 3\n }\n ]\n }\n ],\n \"namedRanges\": [\n {\n \"namedRangeId\": \"1827042098\",\n \"name\": \"NamedRange\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 1,\n \"endColumnIndex\": 3\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1fOQu4HoVgs_JAvi_-KYm9z_Qmcy03Y7F-nZwXtlpNrY?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Length": [ + "0" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Pragma": [ + "no-cache" + ], + "Content-Type": [ + "text/html" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 Nov 2023 12:30:37 GMT" + ], + "Vary": [ + "Origin, X-Origin" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 62279db4c..bdbc81f5e 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -176,6 +176,32 @@ def test_get_values_merge_cells_from_centre_of_sheet(self): ) self.assertEqual(values_with_merged, expected_values) + @pytest.mark.vcr() + def test_get_values_merge_cells_with_named_range(self): + self.sheet.resize(4, 3) + sheet_data = [ + ["1", "2", "4"], + ["down", "up", ""], + ["", "", "2"], + ["num", "val", ""], + ] + self.sheet.update("A1:C4", sheet_data) + self.sheet.merge_cells("A2:A3") + self.sheet.merge_cells("C1:C2") + + request_range = "NamedRange" + self.sheet.define_named_range("B1:C3", request_range) + expected_values = [ + ["2", "4"], + ["up", "4"], + ["", "2"], + ] + + values_with_merged = self.sheet.get_values( + request_range, combine_merged_cells=True + ) + self.assertEqual(values_with_merged, expected_values) + @pytest.mark.vcr() def test_get_values_and_maintain_size(self): """test get_values with maintain_size=True"""