google apps script - Get the spreadsheet key that is in the URL. Not ss.getId() -
How to get a spreadsheet ID in the URL I'm aware of using SpreadsheetApp.getActiveSpreadsheet (). GetId () and SpreadsheetApp.getActiveSpreadsheet (). GetURL ()
but getId () / getURL () / getKey () now fails with Google Drive-SDK. I am not able to use this ID to open a file with drive-SDK. It was working about 1 week ago, but the drive-SDK now fails to open the file.
Using an ID that is present in the URL is an alternative solution. After the key ID =
But I want automatic ways to get it, not a manual process. Using a template as a spreadsheet, I have no way of knowing ID, so is there a way to get it?
Note 1: stackoverflow.com/questions/18583885/ Google Drive SDK issues should be posted on the Stackoverflow flow
Note 2: ID in getUrl () and getKey () As the IID () is not the same key. So it seems that the key has been removed from access, so I do not have much hope.
Edit
Drive code is Java instead of Google Apps-script version 1.15.0-RC I think it broke in the last week or so at some time. It fails with executed (), it generates a 404 error returns this error when I use it with a small spreadsheet that is created by Google Apps Script but whenever I use the browser URL key value I'm still working fine.
You do not show codes which is not working for you, but for me the following works are okay
function myFunction () {// A new spreadsheet workbook var ss = SpreadsheetApp.create ("Test"); Var id = ss.getId (); Get SS file via drive using Logger.log (id) // Spreadsheet ID var file = DriveApp.getFileById (id); Var driveid = file.getId (); Open the spreadsheet using the logger.log (driveid) // file ID ssfromdrive = SpreadsheetApp.openById (driveid); Logger.log (ssfromdrive.getName ())}
Comments
Post a Comment