问题描述
我有一个包含 2000 多个文件的文件夹.我需要在 google 电子表格上列出所有这些文件.我在网上找到了一些脚本.但它们并没有完全正常工作.当我点击RUN"时,我只会得到一个包含 250 个文件的列表.
I have a Folder With more than 2000 Files.. And i Need to make a List of all these files on google spreadsheet.. I Found online some Scripts.. but they're not completely working. When i hit "RUN" i just get a list of 250 Files.
在阅读 Google Developers 页面时,我发现了一些有关启用 Google Drive 高级服务的信息(我做到了)..而且我认为我可以使用名为令牌"的东西来解决这个问题??
Reading on Google Developers page i found some things about enabling Google Drive advanced services (and i did it).. And i think i could solve this problem using something named "tokens"??
我不知道..我不是程序员,我几乎不会英语..我尝试编辑此脚本,将我在网上找到的内容融合在一起.但一切正常.我只是得到了我什至无法理解的错误.
I don't know.. i'm not a programmer, and i barely know english.. i Tried editing this script making a fusion of what i found online.. But anything works.. i just get errors that i can't even understand..
所以.. 有没有人可以解决它?
So.. is there someone able to fix it?
function listFilesInFolder() {
var folder = DocsList.getFolder("Film");
var contents = folder.getFiles();
var file;
var data;
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clear();
sheet.appendRow(["Nome", "Data", "Dimensione"]);
for (var i = 0; i < contents.length; i++) {
file = contents[i];
if (file.getFileType() == "SPREADSHEET") {
continue;
}
data = [
file.getName(),
file.getDateCreated(),
file.getSize(),
];
sheet.appendRow(data);
}
};
推荐答案
此脚本适用于至少 2200 个文件 :)
This Script works for at least 2200 Files :)
function listFilesInFolder(id) {
var folder = DriveApp.getFolderById('MyFolderID');
var contents = folder.getFiles();
var file;
var name;
var sheet = SpreadsheetApp.getActiveSheet();
var date;
var size;
sheet.clear();
sheet.appendRow(["Nome", "Data", "Dimensione"]);
while(contents.hasNext()) {
file = contents.next();
name = file.getName();
date = file.getDateCreated()
size = file.getSize()
data = [name, date, size]
sheet.appendRow(data);
}
};
这篇关于如何在 Google 电子表格上列出 Google Drive 文件夹中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!