Enum MimeType
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
MimeType
การแจกแจงที่ให้สิทธิ์เข้าถึงการประกาศประเภท MIME โดยไม่ต้องพิมพ์สตริงอย่างชัดเจน เมธอดที่คาดหวังประเภท MIME ที่แสดงผลเป็นสตริง (เช่น
'image/png'
) จะยอมรับค่าใดก็ได้ด้านล่าง ตราบใดที่เมธอดรองรับประเภท MIME พื้นฐาน
// Use MimeType enum to log the name of every Google Doc in the user's Drive.
const docs = DriveApp.getFilesByType(MimeType.GOOGLE_DOCS);
while (docs.hasNext()) {
const doc = docs.next();
Logger.log(doc.getName());
}
// Use plain string to log the size of every PNG in the user's Drive.
const pngs = DriveApp.getFilesByType('image/png');
while (pngs.hasNext()) {
const png = pngs.next();
Logger.log(png.getSize());
}
พร็อพเพอร์ตี้
พร็อพเพอร์ตี้ | ประเภท | คำอธิบาย |
GOOGLE_APPS_SCRIPT | Enum | การนําเสนอประเภท MIME สําหรับโปรเจ็กต์ Google Apps Script |
GOOGLE_DRAWINGS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google Drawings |
GOOGLE_DOCS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google เอกสาร |
GOOGLE_FORMS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google ฟอร์ม |
GOOGLE_SHEETS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google ชีต |
GOOGLE_SITES | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google Sites |
GOOGLE_SLIDES | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Google สไลด์ |
FOLDER | Enum | การนำเสนอประเภท MIME สำหรับโฟลเดอร์ Google ไดรฟ์ |
SHORTCUT | Enum | การนำเสนอประเภท MIME สำหรับทางลัด Google ไดรฟ์ |
BMP | Enum | การนําเสนอประเภท MIME สําหรับไฟล์ภาพ BMP (ปกติจะเป็น .bmp) |
GIF | Enum | การนำเสนอประเภท MIME สำหรับไฟล์รูปภาพ GIF (โดยทั่วไปคือ .gif) |
JPEG | Enum | การนําเสนอประเภท MIME สําหรับไฟล์รูปภาพ JPEG (โดยทั่วไปคือ .jpg) |
PNG | Enum | การนําเสนอประเภท MIME สําหรับไฟล์รูปภาพ PNG (ปกติจะเป็น .png) |
SVG | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ภาพ SVG (โดยทั่วไปคือ .svg) |
PDF | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ PDF (โดยทั่วไปคือ .pdf) |
CSS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ข้อความ CSS (โดยทั่วไปคือ .css) |
CSV | Enum | การนําเสนอประเภท MIME สําหรับไฟล์ข้อความ CSV (ปกติจะเป็น .csv) |
HTML | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ข้อความ HTML (โดยทั่วไปคือ .html) |
JAVASCRIPT | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ข้อความ JavaScript (โดยทั่วไปคือ .js) |
PLAIN_TEXT | Enum | การนําเสนอประเภท MIME สําหรับไฟล์ข้อความธรรมดา (ปกติจะเป็น .txt) |
RTF | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Rich Text (โดยทั่วไปคือ .rtf) |
OPENDOCUMENT_GRAPHICS | Enum | การนำเสนอประเภท MIME สำหรับไฟล์กราฟิก OpenDocument (โดยทั่วไปคือ .odg) |
OPENDOCUMENT_PRESENTATION | Enum | การนำเสนอประเภท MIME สำหรับไฟล์งานนำเสนอ OpenDocument (โดยปกติคือ .odp) |
OPENDOCUMENT_SPREADSHEET | Enum | การนำเสนอประเภท MIME สำหรับไฟล์สเปรดชีต OpenDocument (โดยทั่วไปคือ .ods) |
OPENDOCUMENT_TEXT | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ประมวลผลคำ OpenDocument (โดยปกติคือ .odt) |
MICROSOFT_EXCEL | Enum | การนำเสนอประเภท MIME สำหรับไฟล์สเปรดชีต Microsoft Excel (โดยทั่วไปคือ .xlsx) |
MICROSOFT_EXCEL_LEGACY | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Microsoft Excel รุ่นเดิม (โดยทั่วไปคือ .xls) |
MICROSOFT_POWERPOINT | Enum | การนำเสนอประเภท MIME สำหรับไฟล์งานนำเสนอ Microsoft PowerPoint (โดยทั่วไปคือ .pptx) |
MICROSOFT_POWERPOINT_LEGACY | Enum | การนำเสนอประเภท MIME สำหรับไฟล์ Microsoft PowerPoint รุ่นเดิม (โดยทั่วไปคือ .ppt) |
MICROSOFT_WORD | Enum | การนำเสนอประเภท MIME สำหรับไฟล์เอกสาร Microsoft Word (โดยทั่วไปคือ .docx) |
MICROSOFT_WORD_LEGACY | Enum | การนำเสนอประเภท MIME สำหรับไฟล์เดิมของ Microsoft Word (โดยทั่วไปคือ .doc) |
ZIP | Enum | การนำเสนอประเภท MIME สำหรับไฟล์เก็บถาวร ZIP (โดยทั่วไปคือ .zip) |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eMimeType\u003c/code\u003e is an enumeration providing access to MIME-type declarations without manually typing strings, offering a more convenient way to specify file types in Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eMethods accepting MIME types as strings (e.g., \u003ccode\u003e'image/png'\u003c/code\u003e) also accept \u003ccode\u003eMimeType\u003c/code\u003e enum values if the underlying MIME type is supported.\u003c/p\u003e\n"],["\u003cp\u003eThis enumeration covers a wide range of file types, including Google Workspace files, common image and document formats, and Microsoft Office file types.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided property table for a comprehensive list of supported MIME types and their corresponding \u003ccode\u003eMimeType\u003c/code\u003e enum values.\u003c/p\u003e\n"]]],[],null,["# Enum MimeType\n\nMimeType\n\nAn enumeration that provides access to MIME-type declarations without typing the strings\nexplicitly. Methods that expect a MIME type rendered as a string (for example, `\n'image/png'`) also accept any of the values below, so long as the method supports the\nunderlying MIME type.\n\n```javascript\n// Use MimeType enum to log the name of every Google Doc in the user's Drive.\nconst docs = DriveApp.getFilesByType(MimeType.GOOGLE_DOCS);\nwhile (docs.hasNext()) {\n const doc = docs.next();\n Logger.log(doc.getName());\n}\n\n// Use plain string to log the size of every PNG in the user's Drive.\nconst pngs = DriveApp.getFilesByType('image/png');\nwhile (pngs.hasNext()) {\n const png = pngs.next();\n Logger.log(png.getSize());\n}\n``` \n\n### Properties\n\n| Property | Type | Description |\n|-------------------------------|--------|---------------------------------------------------------------------------------------------|\n| `GOOGLE_APPS_SCRIPT` | `Enum` | Representation of MIME type for a Google Apps Script project. |\n| `GOOGLE_DRAWINGS` | `Enum` | Representation of MIME type for a Google Drawings file. |\n| `GOOGLE_DOCS` | `Enum` | Representation of MIME type for a Google Docs file. |\n| `GOOGLE_FORMS` | `Enum` | Representation of MIME type for a Google Forms file. |\n| `GOOGLE_SHEETS` | `Enum` | Representation of MIME type for a Google Sheets file. |\n| `GOOGLE_SITES` | `Enum` | Representation of MIME type for a Google Sites file. |\n| `GOOGLE_SLIDES` | `Enum` | Representation of MIME type for a Google Slides file. |\n| `FOLDER` | `Enum` | Representation of MIME type for a Google Drive folder. |\n| `SHORTCUT` | `Enum` | Representation of MIME type for a Google Drive shortcut. |\n| `BMP` | `Enum` | Representation of MIME type for a BMP image file (typically .bmp). |\n| `GIF` | `Enum` | Representation of MIME type for a GIF image file (typically .gif). |\n| `JPEG` | `Enum` | Representation of MIME type for a JPEG image file (typically .jpg). |\n| `PNG` | `Enum` | Representation of MIME type for a PNG image file (typically .png). |\n| `SVG` | `Enum` | Representation of MIME type for an SVG image file (typically .svg). |\n| `PDF` | `Enum` | Representation of MIME type for a PDF file (typically .pdf). |\n| `CSS` | `Enum` | Representation of MIME type for a CSS text file (typically .css). |\n| `CSV` | `Enum` | Representation of MIME type for a CSV text file (typically .csv). |\n| `HTML` | `Enum` | Representation of MIME type for an HTML text file (typically .html). |\n| `JAVASCRIPT` | `Enum` | Representation of MIME type for a JavaScript text file (typically .js). |\n| `PLAIN_TEXT` | `Enum` | Representation of MIME type for a plain text file (typically .txt). |\n| `RTF` | `Enum` | Representation of MIME type for a rich text file (typically .rtf). |\n| `OPENDOCUMENT_GRAPHICS` | `Enum` | Representation of MIME type for an OpenDocument graphics file (typically .odg). |\n| `OPENDOCUMENT_PRESENTATION` | `Enum` | Representation of MIME type for an OpenDocument presentation file (typically .odp). |\n| `OPENDOCUMENT_SPREADSHEET` | `Enum` | Representation of MIME type for an OpenDocument spreadsheet file (typically .ods). |\n| `OPENDOCUMENT_TEXT` | `Enum` | Representation of MIME type for an OpenDocument word-processing file (typically .odt). |\n| `MICROSOFT_EXCEL` | `Enum` | Representation of MIME type for a Microsoft Excel spreadsheet file (typically .xlsx). |\n| `MICROSOFT_EXCEL_LEGACY` | `Enum` | Representation of MIME type for a Microsoft Excel legacy file (typically .xls). |\n| `MICROSOFT_POWERPOINT` | `Enum` | Representation of MIME type for a Microsoft PowerPoint presentation file (typically .pptx). |\n| `MICROSOFT_POWERPOINT_LEGACY` | `Enum` | Representation of MIME type for a Microsoft PowerPoint legacy file (typically .ppt). |\n| `MICROSOFT_WORD` | `Enum` | Representation of MIME type for a Microsoft Word document file (typically .docx). |\n| `MICROSOFT_WORD_LEGACY` | `Enum` | Representation of MIME type for a Microsoft Word legacy file (typically .doc). |\n| `ZIP` | `Enum` | Representation of MIME type for a ZIP archive file (typically .zip). |"]]