Expression to get Table Data "Source Id"

Hi evreyone,

Is there an Expression that retrieves the Source Id?

2022-04-18_07h13_30.png

I know there have been many requests for this in the past, but this is because Apps Script integration is now available and there are more and more cases where people want to use data sources from spreadsheets.

Note that when Google Drive is used as the data source, the parent folder ID can be obtained by passing the file ID to the Apps Script as shown below.
This will be the Table Data Source Id in AppSheet.

function getSourceId(fileId) {
  const file = DriveApp.getFileById(fileId);
  const parentsFolder = file.getParents();

  Logger.log(parentsFolder.next().getId());
}

I want to achieve the same thing in the Google sheet.

Thanks,

@carlinyuen 
@nico 

@Koichi_Tsuji 

Solved Solved
4 10 1,489
1 ACCEPTED SOLUTION

Why not store the ID in a tab in the Google Sheet, then you could access it as a table in AppSheet. If you wanted to have the cell automatically update (something that would really only be useful if you were likely to copy the Sheet) then you could add a script like the following to the spreadsheet:

function myID() {
   var thisURL = SpreadsheetApp.getActiveSpreadsheet().getUrl();
   var regex = new RegExp("\/d\/(.+)\/edit");
   var res = regex.exec(thisURL);
   return res[1];
}

View solution in original post

10 REPLIES 10
Top Labels in this Space