How to handle excel pop up when opening the excel files

I’ve done this in powershell, since I prefer not to use WScript if possible.
The below script suppresses the update links question in two different ways - take a look and see which one suits you, or if you want to be super sure, you can use both.
This also ensures that the file is open for writes - check the Workbooks.Open syntax and update accordingly if you’d prefer it to open read only.

param(
	[Parameter(Mandatory = $true, Position = 1)]
	[string] $path
)

$excel = New-Object -ComObject Excel.Application
$excel.Visible = $true
$excel.DisplayAlerts = $false

# Globally suppress popup asking to update links (within current instance)
$excel.AskToUpdateLinks = $false

# Open the workbook
# Syntax and notes: https://docs.microsoft.com/en-us/office/vba/api/excel.workbooks.open
# Workbooks.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad)
# UpdateLinks is either 0 (do not update links) or 3 (update links)
$workbook = $excel.Workbooks.Open($path, 0, $false)
1 Like