I have a process that needs to monitor an excel sheet and when a change happens the bot will trigger to take actions within seconds. The excel sheet must remain open even after the bot is done operating.
I’ve tried to work around the restriction of having the excel sheet open by copying the file, saving the initial values and then another copy for the “current values”. However, this isn’t working as the excel file is large and takes a while for the bot to copy and operate on.
There are a few ways to monitor an Excel file for changes in UiPath without having to keep the file open.
use the File Change Trigger activity. This activity will monitor the specified file for changes and trigger a process when a change is detected.
An example of how to use the File Change Trigger activity to monitor an Excel file for changes:
`// Create a new File Change Trigger activity.
var fileChangeTrigger = New FileChangeTrigger("C:\Path\To\ExcelFile.xlsx");
// Register the File Change Trigger activity with the UiPath Robot.
fileChangeTrigger.StartMonitoring();
// Create a new process that will be triggered when a change is detected.
var triggeredProcess = New Process("TriggeredProcess");
// Add the triggered process to the File Change Trigger activity.
fileChangeTrigger.TriggeredProcess = triggeredProcess;
// Start the File Change Trigger activity.
fileChangeTrigger.Start();
// The triggered process will now be executed whenever a change is detected in the Excel file.`
And on this
It is not recommended to keep a copy of the Excel file and try on it, as this can lead to performance issues and data inconsistencies.
But Excel Application Scope activity or use excel allows you to interact with an Excel file without having to keep it open. To keep the Excel file open, simply set the Visible or Keep excel file open property of the Excel Application Scope activity to True .
Hey thanks so much for the help! I have tried the excel application scope where the visible property is checked, however that causes the excel file to close after the bot has done reading the sheet
does the fileChangeTrigger also work with just monitoring a specifc range inside an excel? for example I want to just monitor range I2:02
May be at the end use a open application or start process activity where pass the file path of excel as input
Or
Even an excel application scope itself is fine to keep at but with no excel activities inside
And file trigger can manage only saved changes
Not in specific range
May be once a change is found you can know the change with excel activities by reading them as a datatable and analyse further