Enum MimeType

MimeType

An enumeration that provides access to MIME-type declarations without typing the strings explicitly. Methods that expect a MIME type rendered as a string (for example, 'image/png') also accept any of the values below, so long as the method supports the underlying MIME type.

// Use MimeType enum to log the name of every Google Doc in the user's Drive.
var docs = DriveApp.getFilesByType(MimeType.GOOGLE_DOCS);
while (docs.hasNext()) {
 var doc = docs.next();
 Logger.log(doc.getName())
}

// Use plain string to log the size of every PNG in the user's Drive.
var pngs = DriveApp.getFilesByType('image/png');
while (pngs.hasNext()) {
 var png = pngs.next();
 Logger.log(png.getSize());
}

Properties

PropertyTypeDescription
GOOGLE_APPS_SCRIPTEnumRepresentation of MIME type for a Google Apps Script project.
GOOGLE_DRAWINGSEnumRepresentation of MIME type for a Google Drawings file.
GOOGLE_DOCSEnumRepresentation of MIME type for a Google Docs file.
GOOGLE_FORMSEnumRepresentation of MIME type for a Google Forms file.
GOOGLE_SHEETSEnumRepresentation of MIME type for a Google Sheets file.
GOOGLE_SITESEnumRepresentation of MIME type for a Google Sites file.
GOOGLE_SLIDESEnumRepresentation of MIME type for a Google Slides file.
FOLDEREnumRepresentation of MIME type for a Google Drive folder.
SHORTCUTEnumRepresentation of MIME type for a Google Drive shortcut.
BMPEnumRepresentation of MIME type for a BMP image file (typically .bmp).
GIFEnumRepresentation of MIME type for a GIF image file (typically .gif).
JPEGEnumRepresentation of MIME type for a JPEG image file (typically .jpg).
PNGEnumRepresentation of MIME type for a PNG image file (typically .png).
SVGEnumRepresentation of MIME type for an SVG image file (typically .svg).
PDFEnumRepresentation of MIME type for a PDF file (typically .pdf).
CSSEnumRepresentation of MIME type for a CSS text file (typically .css).
CSVEnumRepresentation of MIME type for a CSV text file (typically .csv).
HTMLEnumRepresentation of MIME type for an HTML text file (typically .html).
JAVASCRIPTEnumRepresentation of MIME type for a JavaScript text file (typically .js).
PLAIN_TEXTEnumRepresentation of MIME type for a plain text file (typically .txt).
RTFEnumRepresentation of MIME type for a rich text file (typically .rtf).
OPENDOCUMENT_GRAPHICSEnumRepresentation of MIME type for an OpenDocument graphics file (typically .odg).
OPENDOCUMENT_PRESENTATIONEnumRepresentation of MIME type for an OpenDocument presentation file (typically .odp).
OPENDOCUMENT_SPREADSHEETEnumRepresentation of MIME type for an OpenDocument spreadsheet file (typically .ods).
OPENDOCUMENT_TEXTEnumRepresentation of MIME type for an OpenDocument word-processing file (typically .odt).
MICROSOFT_EXCELEnumRepresentation of MIME type for a Microsoft Excel spreadsheet file (typically .xlsx).
MICROSOFT_EXCEL_LEGACYEnumRepresentation of MIME type for a Microsoft Excel legacy file (typically .xls).
MICROSOFT_POWERPOINTEnumRepresentation of MIME type for a Microsoft PowerPoint presentation file (typically .pptx).
MICROSOFT_POWERPOINT_LEGACYEnumRepresentation of MIME type for a Microsoft PowerPoint legacy file (typically .ppt).
MICROSOFT_WORDEnumRepresentation of MIME type for a Microsoft Word document file (typically .docx).
MICROSOFT_WORD_LEGACYEnumRepresentation of MIME type for a Microsoft Word legacy file (typically .doc).
ZIPEnumRepresentation of MIME type for a ZIP archive file (typically .zip).