0

I am not able to zip the file. For individual file, no problem.

I am no specialist, no coder, I just have to manage tones of DATA, I was doing things one file at the time, but the company is progressing so fast it will not be sustenable, I am asking newbee questions, sorry for that.

function zipall() {
var ss = SpreadsheetApp.openById("1Ib6ul8KHIcRfE1lJVpWou6SU9bYdBnU-jd8d5eEuWnw");
SpreadsheetApp.setActiveSpreadsheet(ss);
var sheet = ss.getSheetByName('Drive管理用');


for(var i=93; i<94; i++){

if (AdressData != 0 ){ 

var AdressData = sheet.getRange(i,26).getValue();
var folder = DriveApp.getFolderById(AdressData);
var files = folder.getFiles();
var blobs = [];
while (files.hasNext()) {
blobs.push(files.next().getBlob());
}
var zipBlob = Utilities.zip(blobs, folder.getName() + ".zip");
var fileId = DriveApp.createFile(zipBlob).getId()
//var url = "https://drive.google.com/uc?export=download&id=" + fileId;
//sheet.getRange(i,27).setValue(url);

}}}

I have an other error message

"File selection.zip exceeds the maximum file size.(行 19、ファイル「Code」) 表示しない" Message is shown

But I never had a size problem when I do it manually.

???

Tsurubaso
  • 25
  • 8
  • Possible duplicate of [Creating a zip file inside google drive with apps script](https://stackoverflow.com/questions/13259041/creating-a-zip-file-inside-google-drive-with-apps-script) – AMolina Jun 17 '19 at 08:42
  • @Tsurubaso The error message means that the standalone script is included in the folder and it cannot be directly retrieved by ``getBlob()``. About the standalone script, how do you want to do? By the way, also if Google Form is included in the folder, an error occurs at ``getBlob()``. – Tanaike Jun 17 '19 at 22:42
  • As you can easily guess, I am taking here and there from codes, I didn't had the time to research about what Blob was, I now I am a bad Panda, ok, then If I understood well, the code is calling for standalone code, ok...?, this is all I have, what I don't understand is that, there is no problem when I do it for individual folder. There is no Google form in the folder. Completely lost on what to do next. Great thanks for your precious help!!! Tanaike san – Tsurubaso Jun 18 '19 at 00:05
  • https://www.techopedia.com/definition/788/binary-large-object-blob – Tsurubaso Jun 18 '19 at 00:49
  • Although I'm not sure about your actual situation, in the current stage, the size of blob which can be used with ``DriveApp.createFile(blob)`` is less than 50 MB (52,428,800 bytes). When the size is over 50 MB, such error occurs. Can you confirm the size of ``zipBlob``? And as a test case, can you test your script using a sample file with the small size? By the way, can you explain about the detail of ``I never had a size problem when I do it manually.``? – Tanaike Jun 19 '19 at 02:11

0 Answers0