Hi Charles
Thank you for reaching out to Microsoft Q&A Forum and sharing your question about automating data updates in Visio diagrams linked to Excel or SQL.
To clarify, Visio is designed to maintain the connection string, so you don't need to re-import data unless the source file location or SQL credentials change.
If your diagram is linked to an external data source (Excel, SQL, SharePoint lists), you may consider built-in refresh options:
- Use Data > Refresh Data to update linked shapes manually.
- To automate updates, select Configure Refresh and set an interval for automatic refresh. Ensure you define a unique identifier (key column) so Visio can match rows correctly during refresh.
- For your reference: Refresh imported data - Microsoft Support.
Standard refresh updates shape data and graphics but does not add or remove shapes when rows are added or deleted.
If you need shapes created or removed automatically, consider Data Visualizer templates (available in Visio Plan 2). These templates can regenerate flowcharts or org charts from Excel when data changes, though layout adjustments may occur after refresh. Always maintain a stable unique ID in your source to avoid broken links.
For advanced automation, Visio supports VBA macros using the DataRecordset.Refresh method to programmatically refresh linked data from external sources like Excel or SQL. This requires Visio Professional or Plan 2 with VBA enabled. Note that this method updates data in linked shapes only. For further details: DataRecordset.Refresh method (Visio) | Microsoft Learn.
Please let me know how you get on, as your feedback is valuable to the community.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.