我正在使用谷歌驱动器 apiv3 将电子表格复制到谷歌驱动器上的文件夹中。该文档指出“名称”属性应该用于设置新工作表的标题。我正在使用它,但新创建的工作表被命名为“{titleOfSheetToCopy} 的副本”。
要求:
app.get('/new', function (req, res)
{
var drive = google.drive({version:'v3', auth: jwt_client});
var copyRequest = {
name: 'im a copy',
fileId: 'idOfSheetToClone',
parents: ['idOfDestinationFolder'],
}
drive.files.copy(copyRequest, function(err, response){
if(err){
console.log(err);
res.send('error');
return;
}
res.send(response);
});
});
Run Code Online (Sandbox Code Playgroud)
回复:
{
"config": {
"url": "https://www.googleapis.com/drive/v3/files/-----/copy?name=im%20a%20copy&parents=---",
"method": "POST",
"headers": {
"Accept-Encoding": "gzip",
"User-Agent": "google-api-nodejs-client/0.7.2 (gzip)",
"Authorization": "---",
"Accept": "application/json"
},
"params": {
"name": "im a copy",
"parents": [
"---"
]
},
"responseType": "json"
},
"data": {
"kind": "drive#file",
"id": "---", …Run Code Online (Sandbox Code Playgroud)