Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này mô tả cách khắc phục lỗi với Sheets API.
400 Bad Request
Lỗi này cho biết yêu cầu không đúng định dạng. Để khắc phục sự cố liên quan đến các yêu cầu này, hãy xem tài liệu tham khảo và trang hỗ trợ.
500 Internal Server Error
Nếu bạn gặp lỗi 500 khi sử dụng API Trang tính, thì điều này thường cho biết có vấn đề với chính API. Gửi báo cáo lỗi trên Công cụ theo dõi lỗi của Sheets API kèm theo yêu cầu gây ra lỗi.
503 Service Unavailable
Sheets API trả về lỗi 503 khi dịch vụ không hoạt động hoặc khi độ phức tạp của yêu cầu hoặc bảng tính ở mức cao. Sau đây là một số đề xuất để hạn chế tần suất xuất hiện lỗi 503 bằng cách sửa đổi các yêu cầu API và bảng tính cơ bản.
Yêu cầu
Sử dụng batchUpdate để kết hợp các bản cập nhật có liên quan thành một yêu cầu duy nhất.
Hãy thận trọng khi gộp các bản cập nhật lớn vì thao tác này có thể kích hoạt thời gian chờ.
Giới hạn số lượng yêu cầu đồng thời gửi đến API cho mỗi bảng tính là 1 yêu cầu mỗi giây.
Đối với các bảng tính lớn, chỉ cần truy xuất các giá trị cần thiết trong bảng tính bằng cách sử dụng ký hiệu A1 và hạn chế sử dụng includeGridData.
Sử dụng mặt nạ trường để giới hạn lượng dữ liệu mà API trả về.
Sử dụng thuật toán thời gian đợi luỹ thừa khi thử lại các yêu cầu.
Bảng tính
Đối với những trang tính thường xuyên được cập nhật, hãy định kỳ chuyển sang một bảng tính mới để giảm số lượng phiên bản tích luỹ.
Hạn chế sử dụng IMPORTRANGE, QUERY và các công thức phức tạp khác.
Hãy cân nhắc việc chia các bảng tính lớn thành nhiều bảng tính.
Hạn chế việc sử dụng một bảng tính duy nhất làm nguồn cho nhiều công thức IMPORTRANGE.
Chỉ cấp quyền truy cập vào bảng tính cho những người cần thiết.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[],[],null,["# Troubleshoot API errors\n\nThis page describes how to troubleshoot errors with the Sheets API.\n| **Note:** The [Status\n| Dashboard](https://www.google.com/appsstatus/dashboard/) is a good place to start when troubleshooting errors with the Sheets API. It provides real-time information about the status of the Sheets API.\n\n`400 Bad Request`\n-----------------\n\nThis error indicates that the request was malformed. For troubleshooting these\nrequests, see the [reference documentation](https://developers.google.com/workspace/sheets/api/reference/rest) and the\n[support page](https://developers.google.com/workspace/sheets/api/support#questions_advice).\n\n`500 Internal Server Error`\n---------------------------\n\nIf you are encountering 500 errors when using the Sheets API, it\ntypically indicates that there is an issue with the API itself. File a bug\nreport on the Sheets API [Issue Tracker](https://developers.google.com/workspace/sheets/api/support#developer_product_feedback) with the request that caused\nthe error.\n\n`503 Service Unavailable`\n-------------------------\n\nThe Sheets API returns a 503 error when the service is unavailable or\nwhen the complexity of the request or spreadsheet is high. The following are\nsome suggestions to limit the rate of 503 errors by modifying the API requests\nand the underlying spreadsheet.\n\n### Request\n\n- Use [`batchUpdate`](https://developers.google.com/workspace/sheets/api/guides/batch) to combine related updates into a single request. Exercise caution when batching large updates as this might trigger a timeout.\n- Limit the number of concurrent requests to the API per spreadsheet to 1 request per second.\n- For large spreadsheets, retrieve only the necessary spreadsheet values using [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) and limit the use of [`includeGridData`](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/get#query-parameters).\n- Use [field masks](https://developers.google.com/workspace/sheets/api/guides/performance#partial) to limit the amount of data returned by the API.\n- Use exponential backoff when retrying requests.\n\n### Spreadsheet\n\n- For frequently updated sheets, rotate to a new spreadsheet periodically to reduce accumulation of versions.\n- Limit the use of [`IMPORTRANGE`](https://support.google.com/docs/answer/3093340), [`QUERY`](https://support.google.com/docs/answer/3093343), and other complex formulas.\n- Consider splitting large spreadsheets into multiple spreadsheets.\n- Limit the use of a single spreadsheet as a source for many [`IMPORTRANGE`](https://support.google.com/docs/answer/3093340) formulas.\n- Limit access to the spreadsheet to only those who need it."]]