Is there a working script for importrange (google sheets)? I have done a ton of research and tried scripting one myself and google app scripts just seem to not take the following function:
SpreadsheetApp.openById( key )
According to my research openById is no longer supported and this function has been altered.
Please let me know what I can do to improve on this script and see if there's anything I'm missing.
(EDIT) I want to import a sheet named "Data", from my Service Area Test Spreadsheet to a sheet called "Import Here" from my Test Development Spreadsheet.
function ExportRange() {
var destination = SpreadsheetApp.openById(DESTINATION SPREADSHEET ID HERE);
var destinationSheet = destination.getActiveSheet();
var destinationCell = destinationSheet.getRange(SET DESTINATION CELL EXAMPLE:"A1");
var cellData = '=IMPORTRANGE(origin spreadsheet_key, range_string)';
destinationCell.setValue(cellData);
}
Based on the script above, this is how I inserted everything.
function ExportRange() {
var destination = SpreadsheetApp.openById(ID from "Import Here" here);
var destinationSheet = destination.getActiveSheet();
var destinationCell = destinationSheet.getRange("A1"); //Dropping "Data" starting from "A1"
var cellData = '=IMPORTRANGE(ID from "Data" here, "A1:L1")'; // My range string is "A1:L1"
destinationCell.setValue(cellData);
}