Forum Discussion
How to import multiple SQL statements in an Excel file?
Hello
I have several SQL statments that I need to load into Excel sheets in an Excel file.
Can you tell me how to do that smartly please without having to put them one by one?
Thanks!
- Anonymous5 years ago
Anonymous
As far as I know, there isn't a smart way other than doing it 1 by 1, you can only select one worksheet to implement a statement at a time:
How to Embed a SQL Query in Microsoft Excel: 13 Steps (wikihow.com)
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
4 Replies
- mahoneypatMicrosoft Employee
Not sure what you mean. Please clarify. You have multiple SQL statements and you want to load them into separate Excel workbooks? worksheets? where is the SQL stored?
Regards,
Pat
- AnonymousNot applicable
I want to load them into separate excel sheets in the same excel file.
It is currently stored in a text file.
Thanks!
- mahoneypatMicrosoft Employee
You want to pull the SQL from the text file and then execute them in the query editor? Or are you willing to manually make each query using those SQL queries within the same workbook? The latter is easy, the former is trickier but doable.
For the former, you just need to put your SQL into the Advanced options box for each query. Here is a link.
Power Query SQL Server connector | Microsoft Docs
Regards,
Pat
- AnonymousNot applicable
Anonymous
As far as I know, there isn't a smart way other than doing it 1 by 1, you can only select one worksheet to implement a statement at a time:
How to Embed a SQL Query in Microsoft Excel: 13 Steps (wikihow.com)
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.