Red*_*sla 3 json file google-apps-script
我有一个神经网络脚本需要来自 JSON 文件的训练数据,是否可以使用 Google Apps 脚本将 JSON 文件保存到 Google Drive?
您可以使用高级驱动器服务。在 Google Drive 中创建文件有 3 个选项。
目前,Apps Script 既有旧版代码编辑器,也有新版代码编辑器。在两个编辑器中启用高级驱动器服务是不同的。
旧版编辑器:
新编辑:
过去,您还需要在 Google Cloud Platform 中启用 Drive API。但现在你有两个选择。
如果 Apps Script 项目将被公众使用,那么您应该创建一个“标准”Google Cloud 项目,并在 Google Cloud Platform 中启用 Google Drive API。
function saveAsJSON() {
var blob,file,fileSets,obj;
obj = {//Object literal for testing purposes
key:"value"
}
/**
* Creates a file in the users Google Drive
*/
fileSets = {
title: 'AAA_Test.json',
mimeType: 'application/json'
};
blob = Utilities.newBlob(JSON.stringify(obj), "application/vnd.google-apps.script+json");
file = Drive.Files.insert(fileSets, blob);
Logger.log('ID: %s, File size (bytes): %s, type: %s', file.id, file.fileSize, file.mimeType);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6035 次 |
| 最近记录: |