The code below doesn't seem to refresh the data links. Does anyone see the issue?
- Excel.Application xlApp2 = new Excel.Application();
- xlApp2.DisplayAlerts = false;
- xlApp2.Visible = true;
- Excel.Workbook xlWorkbookt2 = xlApp.Workbooks.Open(@ "\\twg-jks-fs01\twg\Sales\Sales_Volume\Consolidated Sales Volume\Daily Note\Auto DOS Files\Go Live\TWG DOS - FY19 Std Rpts Automated HTML Ready.xlsx", 3, false, missing, missing, missing, true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, missing, true, missing, missing, missing, missing, missing);
- Excel._Worksheet xlWorksheet2 = xlWorkbookt2.Sheets[1];
-
- foreach(Microsoft.Office.Interop.Excel.WorkbookConnection conn in xlWorkbookt2.Connections) {
- Console.WriteLine(conn.Name);
- }
- Excel.Range xlRange2 = xlWorksheet2.UsedRange;
- object misValue2 = System.Reflection.Missing.Value;
- mWorkSheets = xlWorkbookt2.Worksheets;
- string text = File.ReadAllText(@ "\\twg-jks-fs01\twg\PublishedApps\DSN\DBTemplate.txt", Encoding.UTF8);
- string buttons = string.Empty;
- string frames = string.Empty;
-
- int cntr = 0;
- try {
- xlWorkbookt2.RefreshAll();
- System.Threading.Thread.Sleep(60000);
-
- xlApp2.Application.CalculateUntilAsyncQueriesDone();
- xlWorkbookt2.Save();
- } catch (Exception ex) {
- Console.WriteLine("failed Refreshing XLSX Links 2");
- }