Answer the question
In order to leave comments, you need to log in
How to open a Table by reference after it has been created?
Greetings!
I want to use GAS to create a copy of the table, and then open it in a new browser tab for editing. Wrote this:
function creatCP(ssID,filename){
var source = DriveApp.getFileById(ssID);
var targetFolder = DriveApp.getFolderById(tagFolderID);
var newFile = source.makeCopy(filename,targetFolder);
var ss = newFile.getUrl();
return ss;
}
.......
var newFileUrl = creatCP(SourceLink,filename);
var newSSopen = SpreadsheetApp.openByUrl(newFileUrl);
SpreadsheetApp.setActiveSheet(newSSopen.getSheets()[1]);
}
Answer the question
In order to leave comments, you need to log in
Everything is pretty simple.
Pass ss value to function
/**
* Open the url in a new tab
* @param {string} url
*/
function openUrlInBrowser_(url) {
const tmp = HtmlService.createTemplateFromFile('app');
tmp.url = url;
const htmlOutput = tmp.evaluate();
SpreadsheetApp.getUi().showModelessDialog(htmlOutput, 'Opening url ...');
}
app.html
in the project/**
* Open the url in a new tab
* @param {string} url
*/
function openUrlInBrowser_(url) {
const tmp = HtmlService.createTemplateFromFile('app');
tmp.url = url;
const htmlOutput = tmp.evaluate();
SpreadsheetApp.getUi().showModelessDialog(htmlOutput, 'Opening url ...');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question