Rename Google Drive Images from Spreadsheet

Modification points :

  1. Data which is retrieved by getValues() is 2 dimensional array.
  2. Data of “C2:C10” and “D2:D10” can be retrieved to an array.

Modified script :

function reName() {
var sheetName = 'Data';
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
var data = sheet.getRange("C2:D10").getValues();
for (var i in data) {
var file = DriveApp.getFileById(data[i][1]);
file.setName(data[i][0]);
}
}

Reference :

• getValues()

Written By:

Sarmad Gardezi A blog scientist by Mind and a Passionate Blogger by heart. Sarmad is Freelancer, Entrepreneur and Google Apps Scripts Developer from Islamabad, Pakistan.

Subscribe to Email Newsletter