I'm using a script to refresh the connection to an Excel file. This to ensure that the latest edit of the file is included when the Excel content is retrieved. I tested the file multiple times. In some instances I got the right content with the updated tables. However, for some instances I did not get the updated tables. It seems that workbook.refreshAllDataConnections() is unreliable. I can't find any cause to the inconsistencies.
First I used a 2 minute delay timer, which is slow and unreliable. Then I found this script on this forum.
The script:
function main(workbook: ExcelScript.Workbook) {
// Refresh all data connections
workbook.refreshAllDataConnections()
;
}
My flow first gets input from a sharepoint list and then
(1) adds the content by editing a row of a table in an excel file.
(2) Edits a row in another table .
(3) Runs script that should refresh the connection to the Excel file.
(4) Gets latest Excel file content via a new connection.
(5) Adds content as attachment to email and saves an Excel file in sharepoint.
