I wrote a script to display a list of names and folder IDs.
The script that I wrote like this:
function listFolders() {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange('A2:B').clear();
//sheet.appendRow(["Name", "Folder-Id"]);
var folderID = DriveApp.getFolderById("1Hp_dM8WR0mGDT5q-a-VS-VVtl5dNCLfe");
var contents = folderID.getFolders();
var cnt = 0;
var lFolder;
while (contents.hasNext()) {
var lFolder = contents.next();
cnt++;
data = [
lFolder.getName(),
lFolder.getId(),
];
sheet.appendRowgetRange(2, 1, data.length, data[0].length).setValues(data); //modified
};
};
I want to add new data in column C. After I fill in a text in column C, then I run the script. But the second row is empty.