Create a Copy Explainer

Yes sir this works. Thanks sir

let contractId = ‘226uAXY0YRUj-HMW5LQZ2YeeJgyDqmJTpnzRkGmFLch0’;

function makeCopy(id, name) {
let file = DriveApp.getFileById(id);
let copy = file.makeCopy(name);
return copy.getId()
}
console.log(makeCopy(contractId, ‘Copy of the contract’));

please help me I am so bad at this

actually I got it by

You can use this if you are stuck

let contractId = ‘226uAXY0YRUj-HMW5LQZ2YeeJgyDqmJTpnzRkGmFLch0’;

function makeCopy(id, name) {
let file = DriveApp.getFileById(id)
let copy = file.makeCopy(name)
return copy.getId()
}

console.log(makeCopy(contractId, ‘Copy of the contract’));

This is easy.
Go to the Rename the Copy puzzle and use that as an example.
let contractId = ‘226uAXY0YRUj-HMW5LQZ2YeeJgyDqmJTpnzRkGmFLch0’;

function makeCopy(id, name) {
let file=DriveApp.getFileById(id);
let copy=file.makeCopy(name);
let copyName=copy.getName();
return copy.getId();

}

console.log(makeCopy(contractId, ‘Copy of the contract’));


Try this!

In “get.FileById” you typed the lowercase “b”.

use the return statement after
‘let copy = file.makeCopy(name)’


What is wrong with this ?

What is the problem?

let contractId = ‘226uAXY0YRUj-HMW5LQZ2YeeJgyDqmJTpnzRkGmFLch0’;

function makeCopy(id, name) {
let file = DriveApp.getFileId(id);
let copy = file.makeCopy(name);
return copy.getId();
}
console.log(makeCopy(contractId, ‘Copy of the contract’));

never mind, I fixed it

let contractId = ‘226uAXY0YRUj-HMW5LQZ2YeeJgyDqmJTpnzRkGmFLch0’;

function makeCopy(id, name) {
let file = DriveApp.getFileById(id)
let copy = file.makeCopy(name)
return copy.getId()

}

console.log(makeCopy(contractId, ‘Copy of the contract’));

Return solo se utiliza dentro de la function