Wondering if anyone has successfully used Utilities.ungzip to take a Gmail Attachment and decompress it. I have the following code which is bombing on on trying to use Utilities.ungzip(). The error message, Error
The console output shows a file with a byte count and mime type of gzip (see below code). I have no idea what I'm doing wrong. Can anyone point me in the right direction?
for (var f of files)
{
var file_name = f.getName();
console.log("Attachment found for: " + file_name);
if ( file_name.match(/\.gz/) )
{
var blob = f.copyBlob();
console.log(files);
console.log(f);
console.log(blob.getSize(), blob.getContentType(), typeof blob);
var uncompressedBlob = Utilities.ungzip(blob.copyBlob());
console.log(typeof uncompressdBlob);
}
}
8:01:17 AM
Info
Attachment found for: Host - Applicable Errata-2022-06-05.csv.gz
8:01:17 AM
Info
[ { toString: [Function],
getSize: [Function],
getHash: [Function],
getName: [Function],
getBytes: [Function],
setName: [Function],
getContentType: [Function],
setContentType: [Function],
setContentTypeFromExtension: [Function],
getDataAsString: [Function],
setDataFromString: [Function],
isGoogleType: [Function],
getAllBlobs: [Function],
copyBlob: [Function],
setBytes: [Function],
getAs: [Function] } ]
8:01:17 AM
Info
{ toString: [Function],
getSize: [Function],
getHash: [Function],
getName: [Function],
getBytes: [Function],
setName: [Function],
getContentType: [Function],
setContentType: [Function],
setContentTypeFromExtension: [Function],
getDataAsString: [Function],
setDataFromString: [Function],
isGoogleType: [Function],
getAllBlobs: [Function],
copyBlob: [Function],
setBytes: [Function],
getAs: [Function] }
8:01:17 AM
Info
1980026 'application/gzip' 'object'