0

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!

Rom
  • 1
  • 2
  • I mean the code is not expected to be followed without modifications. Have you tried to change the cell which you are executing the `refreshData` or the sheet? Also have you debugged your code to know where this is failing? Have you checked that the data you need to refresh is from the 1st `DataSourceTables`? Maybe try to create a mockup spreadsheet to see how is your data laid out. – Raserhin May 01 '20 at 07:54
  • Hi @Raserhin, thank you for your comment. I have tried, and was able to launch the code above, but then it tries to launch bigquery, which is not what I'm tring to do. The code above works, but it doesn't do what I want. I'm putting as an example that is close to what I want. Makes sense? – Rom May 01 '20 at 17:33
  • Could you maybe share a sample sheet? Have you actually created a [`DataSourceTable`](https://developers.google.com/apps-script/reference/spreadsheet/data-source-table)? – Raserhin May 08 '20 at 07:17

0 Answers0