Method: spreadsheets.get
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הפונקציה מחזירה את הגיליון האלקטרוני במזהה הנתון. מבצע הקריאה החוזרת צריך לציין את מזהה הגיליון האלקטרוני.
כברירת מחדל, המערכת לא מחזירה נתונים בתוך רשתות. אפשר לכלול נתוני רשת באחת משתי דרכים:
מציינים מסכת שדה עם פירוט השדות הרצויים באמצעות פרמטר כתובת ה-URL fields
ב-HTTP
מגדירים את הפרמטר של כתובת ה-URL includeGridData
לערך true. אם מוגדר מסכת שדה, המערכת מתעלמת מהפרמטר includeGridData
לגבי גיליונות אלקטרוניים גדולים, מומלץ לאחזר רק את השדות הספציפיים של הגיליון האלקטרוני שרוצים.
כדי לאחזר רק קבוצות משנה של נתוני הגיליון האלקטרוני, משתמשים בפרמטר ה-URL ranges
. מציינים טווחים באמצעות סימון A1. אפשר להגדיר תא יחיד (לדוגמה, A1
) או כמה תאים (לדוגמה, A1:D5
). אפשר גם לקבל תאים מגיליונות אחרים באותו גיליון אלקטרוני (לדוגמה, Sheet2!A1:C4
) או לאחזר כמה טווחים בו-זמנית (לדוגמה, ?ranges=A1:D5&ranges=Sheet2!A1:C4
). הגבלת הטווח מחזירה רק את החלקים בגיליון האלקטרוני שמצטלבים עם הטווחים המבוקשים.
בקשת HTTP
GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}
כתובת ה-URL משתמשת בתחביר של Transcoding של gRPC.
פרמטרים של נתיב
פרמטרים |
spreadsheetId |
string
הגיליון האלקטרוני שרוצים לבקש.
|
פרמטרים של שאילתה
פרמטרים |
ranges[] |
string
הטווחים לאחזור מהגיליון האלקטרוני.
|
includeGridData |
boolean
הערך true אם צריך להחזיר נתוני רשת. המערכת מתעלמת מהפרמטר הזה אם הגדרתם מסכת שדה בבקשה.
|
excludeTablesInBandedRanges |
boolean
הערך True מציין שצריך להחריג טבלאות בטווחים המחולקים. False אם לא מוגדר.
|
גוף הבקשה
גוף הבקשה חייב להיות ריק.
גוף התשובה
אם הפעולה מצליחה, גוף התגובה מכיל מופע של Spreadsheet
.
היקפי הרשאה
נדרש אחד מהיקפי ההרשאות הבאים של OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly
מידע נוסף זמין במדריך ההרשאות.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-04-29 (שעון UTC).
[null,null,["עדכון אחרון: 2025-04-29 (שעון UTC)."],[],[],null,["# Method: spreadsheets.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReturns the spreadsheet at the given ID. The caller must specify the spreadsheet ID.\n\nBy default, data within grids is not returned. You can include grid data in one of 2 ways:\n\n- Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP\n\n- Set the [includeGridData](/workspace/sheets/api/reference/rest/v4/spreadsheets/get#body.QUERY_PARAMETERS.include_grid_data) URL parameter to true. If a field mask is set, the `includeGridData` parameter is ignored\n\nFor large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.\n\nTo retrieve only subsets of spreadsheet data, use the [ranges](/workspace/sheets/api/reference/rest/v4/spreadsheets/get#body.QUERY_PARAMETERS.ranges) URL parameter. Ranges are specified using [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). You can define a single cell (for example, `A1`) or multiple cells (for example, `A1:D5`). You can also get cells from other sheets within the same spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.\n\n### HTTP request\n\n`GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------|--------------------------------------|\n| `spreadsheetId` | `string` The spreadsheet to request. |\n\n### Query parameters\n\n| Parameters ||\n|-------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| `ranges[]` | `string` The ranges to retrieve from the spreadsheet. |\n| `includeGridData` | `boolean` True if grid data should be returned. This parameter is ignored if a field mask was set in the request. |\n| `excludeTablesInBandedRanges` | `boolean` True if tables should be excluded in the banded ranges. False if not set. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [Spreadsheet](/workspace/sheets/api/reference/rest/v4/spreadsheets#Spreadsheet).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `https://www.googleapis.com/auth/drive.readonly`\n- `https://www.googleapis.com/auth/drive.file`\n- `https://www.googleapis.com/auth/spreadsheets`\n- `https://www.googleapis.com/auth/spreadsheets.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]