Forum Discussion
Can a T-SQL procedure copy content of an Excel sheet to another Excel-файл?
- Aug 18, 2025
Hi Victor_Sotnikov unfortunately, No — this cannot be done purely in T-SQL. SQL Server is designed for database operations and does not provide native commands to manipulate Excel files at the sheet level.
You can perform all these steps using
PowerShell + SQL:
Use PowerShell scripts to:
1. Open input Excel, copy sheet content to output Excel (with Import-Excel / Export-Excel modules, or COM Interop).
2. Optionally call that script from SQL Agent if you want it tied to a SQL job.or
ETL Job / SSIS (SQL Server Integration Services):
ETL tool that can import/export between Excel files and SQL, and can also transfer between Excel files.Please change the status to resolved if you are satisfied with the answer.
Hi Victor_Sotnikov unfortunately, No — this cannot be done purely in T-SQL. SQL Server is designed for database operations and does not provide native commands to manipulate Excel files at the sheet level.
You can perform all these steps using
PowerShell + SQL:
Use PowerShell scripts to:
1. Open input Excel, copy sheet content to output Excel (with Import-Excel / Export-Excel modules, or COM Interop).
2. Optionally call that script from SQL Agent if you want it tied to a SQL job.
or
ETL Job / SSIS (SQL Server Integration Services):
ETL tool that can import/export between Excel files and SQL, and can also transfer between Excel files.
Please change the status to resolved if you are satisfied with the answer.