'Google apps script: how to refresh data connector from Salesforce with a script?

I'm using Data Connector from Salesforce addon.

To refresh my data in Google sheet, I usually either setup an automated refresh via the addon, or I click manualy on refresh, still in the addon interface.

What I can't seem to figure how to do is to launch this same refresh but from a Google app script. This post describes what I want to do, but it's for bigQuery. It'd like to know how to do the same, but for the Data connector from Salesforce.

Code that looks like what I need coming from the other post:

function refresh() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A1').activate();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Data Sheet 1'), true);
  SpreadsheetApp.enableAllDataSourcesExecution();
  spreadsheet.getCurrentCell().getDataSourceTables()[0].refreshData();
};

Anyone knows how to do the same with Data connector form Salesforce?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source