In Google sheets it’s possible to ‘Insert > Link’ into a spreadsheet cell. This opens a dialoge where it’s easy to search for other document to which you have access on Google Drive, and thus to insert these into the cell. The cell then appears to contain the name of your chosen file, but by hovering over you can see a preview, and by clicking copy link you can retrieve the URL.
I’d like to retrieve the URLS using Google Apps Script, but all the functions I try return me what’s displayed on screen (a simple file name) rather than the url to that document.
e.g.
function myFunction() {
var videoLink = SpreadsheetApp.getActive().getRange("Sheet1!B2");
var onlyCell = videoLink.getCell(1,1);
Logger.log(onlyCell.getValue()); // Returns the Visible name, not the link...
Logger.log(onlyCell.getFormula()); // retuns empty
Logger.log(onlyCell.getDisplayValue());
Logger.log(onlyCell.getRichTextValue().getText());
}
returns
And ideas? Thankyou.
Sam