Method: files.export
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.
Xuất một tài liệu trên Google Workspace sang loại MIME được yêu cầu và trả về nội dung byte đã xuất. Để biết thêm thông tin, hãy xem phần Tải và xuất tệp.
Xin lưu ý rằng nội dung xuất ra có giới hạn là 10 MB.
Yêu cầu HTTP
GET https://www.googleapis.com/drive/v3/files/{fileId}/export
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
fileId |
string
Mã nhận dạng của tệp.
|
Tham số truy vấn
Thông số |
mimeType |
string
Bắt buộc. Loại MIME của định dạng được yêu cầu cho hoạt động xuất này. Để xem danh sách các loại MIME được hỗ trợ, hãy xem bài viết Xuất loại MIME cho tài liệu trên Google Workspace.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, phương thức này sẽ trả về nội dung tệp dưới dạng byte.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.meet.readonly
https://www.googleapis.com/auth/drive.readonly
Một số phạm vi bị hạn chế và yêu cầu bạn phải đánh giá bảo mật để ứng dụng của bạn có thể sử dụng các phạm vi đó. Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-27 UTC."],[],[],null,["# Method: files.export\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\nExports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB.\n\n### HTTP request\n\n`GET https://www.googleapis.com/drive/v3/files/{fileId}/export`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|------------------------------|\n| `fileId` | `string` The ID of the file. |\n\n### Query parameters\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------|\n| `mimeType` | `string` Required. The MIME type of the format requested for this export. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, this method returns the file content as bytes. For a list of Google Workspace documents and MIME type conversion formats, see [Google Workspace documents and corresponding export MIME types](/drive/api/guides/ref-export-formats).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\n- `\n https://www.googleapis.com/auth/drive.meet.readonly`\n- `\n https://www.googleapis.com/auth/drive.readonly`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]