I am trying to fetch a gzip from a URL and import it automatically into a Google Sheets. The gzip contains one file of CSV data.
I know I can import the CSV data int
I was able to inflate (decompress) a gzipped file using a third party javascript library, pako. Here is the code:
eval(UrlFetchApp.fetch('https://cdn.rawgit.com/nodeca/pako/master/dist/pako.js').getContentText());
var charData = UrlFetchApp.fetch("").getContent();
var binData = [];
for (var i = 0; i < charData.length; i++) {
binData.push(charData[i] < 0 ? charData[i] + 256 : charData[i]);
}
var data = pako.inflate(binData);
var decoded = '';
for (var i = 0; i < data.length; i++) {
decoded += String.fromCharCode(data[i]);
}