I want to convert csv file in drive to new sheet by this code:
function importCSVFromGoogleDrive() {var file = DriveApp.getFilesByName("data.csv").next();var csvData = Utilities.parseCsv(file.getBlob().getDataAsString());var sheet = SpreadsheetApp.getActiveSheet();sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);}but the result show:
TypeError: Cannot read property 'getRange' of nullHow can I fix it or, is there any code can import csv as sheet from Gmail?