Google Apps脚本:搜索文件夹中的所有文档 [英] Google apps script: Search all documents in a folder
本文介绍了Google Apps脚本:搜索文件夹中的所有文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您可以使用GAS在文件夹中的所有文档中搜索字符串,然后返回找到的文档列表?给我一个提示怎么做?
You can search for a string in all documents in a folder with GAS and return the list of found documents? give me a hint of how to do?
谢谢
raffaele
推荐答案
This is all described in the documentation , read also the details about search arguments described here.
他们也给出了一个例子,下面有一个您的要求的例子:
They give an example too, below it an example with your requirements :
function testSearch(){
// Log the name of every file that contains a certain string
// you can get the folder of your choice here by its ID or by its name, in the second case the returned object is a folder iterator so you will have to iterate its content. There are examples all around on how to do that.
var files = DriveApp.getRootFolder().searchFiles(
'fullText contains "example"');
while (files.hasNext()) {
var file = files.next();
Logger.log(file.getName());
}
}
这篇关于Google Apps脚本:搜索文件夹中的所有文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文