با مجموعهها، منظم بمانید ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این بخش یک کد لبه را ارائه می دهد که می توانید از آن برای آشنایی با Google Sheets API استفاده کنید. همچنین مجموعهای از نمونههای «دستور العمل» ارائه شده است که نشان میدهد چگونه یک عملکرد Google Sheets مورد نظر را به یک درخواست API ترجمه کنید.
اغلب بیش از یک راه برای تکمیل یک کار معین با API وجود دارد. هنگامی که تصمیم می گیرید چگونه به یک کار نزدیک شوید، موارد زیر را در نظر داشته باشید:
اگر نیاز به خواندن یا نوشتن مقادیر سلول دارید، مجموعه spreadsheets.values انتخاب بهتری نسبت به مجموعه spreadsheets است. استفاده از رابط اولی برای عملیات خواندن/نوشتن سادهتر است.
از اتمی بودن تمام تغییرات در دسته اطمینان حاصل کنید.
دستور العمل ها
مثالهای فهرستشده در این بخش نحوه بیان کنشهای رایج در Sheets را بهعنوان درخواستهای Sheets API v4 نشان میدهند.
این نمونه ها در قالب درخواست های HTTP برای خنثی بودن زبان ارائه شده اند. برای آشنایی با نحوه پیادهسازی پروتکلهای درخواست Sheets API در یک زبان خاص با استفاده از کتابخانههای سرویس گیرنده Google API، به راهنمای خواندن و نوشتن مقادیر سلول و بهروزرسانی صفحات گسترده مراجعه کنید.
دستور غذاها در این بخش به دسته های زیر تقسیم می شوند:
خواندن پایه — دستور العمل هایی که نحوه خواندن مقادیر از یک برگه را نشان می دهد.
نوشتن پایه - دستور العمل هایی که نحوه نوشتن مقادیر در یک برگه را نشان می دهد.
قالب بندی اولیه — دستور العمل هایی که نحوه تغییر ظاهر برگه ها و سلول ها را نشان می دهد.
نمودارها - دستور العمل هایی که نحوه ایجاد و تغییر نمودارها را در یک برگه نشان می دهد.
قالب بندی مشروط - دستور العمل هایی که نحوه تغییر ظاهر سلول را بر اساس شرایط نشان می دهد.
عملیات داده - دستور العمل هایی که نحوه ایجاد، انتقال و دستکاری داده ها را در یک صفحه گسترده نشان می دهد.
محدودههای نامگذاریشده و محافظتشده - دستور العملهایی که نحوه ایجاد، بهروزرسانی، و حذف محدودههای نامگذاریشده و محافظتشده را در یک صفحهگسترده نشان میدهند.
جداول محوری - دستور العمل هایی که نحوه ایجاد جداول محوری در یک برگه را نشان می دهد.
عملیات سطر و ستون — دستور العمل هایی که نحوه افزودن، حذف و جابجایی سطرها و ستون ها و به روز رسانی ویژگی های آنها را نشان می دهد.
عملیات برگه - دستور العمل هایی که نحوه ایجاد، پاک کردن، کپی و حذف برگه ها و همچنین کنترل خواص آنها را نشان می دهد.
تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی."],[],[],null,["This section presents a\n[codelab](https://codelabs.developers.google.com/codelabs/sheets-api/) you can\nuse to become familiar with the Google Sheets API. Also provided are a set of\n\"recipe\" examples that demonstrate how to translate an intended Google Sheets\naction into an API request.\n\nOften there's more than one way to complete a given task with the API. When\nyou're deciding on how to approach a task, keep the following in mind:\n\n- If you need to read or write cell values, the [`spreadsheets.values`](/workspace/sheets/api/reference/rest/v4/spreadsheets.values) collection is a better choice than the [`spreadsheets`](/workspace/sheets/api/reference/rest/v4/spreadsheets) collection. The former's interface is easier to use for simple read/write operations.\n- Wherever possible, use the batch methods\n ([`spreadsheet.batchUpdate`](/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate),\n [`spreadsheet.values.batchGet`](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/batchGet),\n and\n [`spreadsheet.values.batchUpdate`](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate))\n to bundle multiple requests into a single method call. Using these batch\n methods improves efficiency as they:\n\n - Reduce client HTTP overhead.\n - Reduce the number of queries made.\n - Reduce the number of revisions on the doc.\n - Ensure atomicity of all the changes in the batch.\n\nRecipes\n\nThe examples listed in this section demonstrate how to express common actions in\nSheets as Sheets API v4 requests.\n\nThese examples are presented in the form of HTTP requests to be language\nneutral. To learn how to implement Sheets API request protocols in a\nspecific language using Google API client libraries, see the [Read \\& write cell\nvalues](/workspace/sheets/api/guides/values) and [Update\nspreadsheets](/workspace/sheets/api/guides/batchupdate) guides.\n\nRecipes in this section are divided into the following categories:\n\n- [Basic reading](/workspace/sheets/api/samples/reading)---Recipes that show how to read values from a sheet.\n- [Basic writing](/workspace/sheets/api/samples/writing)---Recipes that show how to write values to a sheet.\n- [Basic formatting](/workspace/sheets/api/samples/formatting)---Recipes that show how to change the appearance of sheets and cells.\n- [Charts](/workspace/sheets/api/samples/charts)---Recipes that show how to create and alter charts in a sheet.\n- [Conditional formatting](/workspace/sheets/api/samples/conditional-formatting)--- Recipes that show how to alter cell appearance based on conditions.\n- [Data operations](/workspace/sheets/api/samples/data)---Recipes that show how to create, move, and manipulate data in a spreadsheet.\n- [Named \\& protected\n ranges](/workspace/sheets/api/samples/ranges)---Recipes that show how to create, update, and remove named and protected ranges in a spreadsheet.\n- [Pivot tables](/workspace/sheets/api/samples/pivot-tables)---Recipes that show how to create pivot tables in a sheet.\n- [Row \\& column\n operations](/workspace/sheets/api/samples/rowcolumn)---Recipes that show how to add, remove, and move rows and columns, and update their properties.\n- [Sheet operations](/workspace/sheets/api/samples/sheet)---Recipes that show how to create, clear, copy, and delete sheets, and also control their properties."]]