Forum Discussion
Mapping Stored Procedure Query Results to Excel Worksheet Columns
Hi copco_online
actually it is the default behaviour that the output columns are in the same order as the input columns.
I suspect that you have somewhere in the query a step "Reordered Columns"
If that's the case, than this is the cause for the behaviour you describe. Just delete that step, if appropriate.
Thank you for the response. I'm not sure if there is a "step" called "Reordered Columns". The source is a stored procedure, and the query cannot be shown graphically within Excel. Is it possible that I'm just not seeing where this is? It seems to me that some sort of mapping is established at the onset when the query definition is constructed. When a field is added in the output of the stored procedure where we would like it, Excel not knowing or recognizing the mapping simply puts it at the end. Where should I look for this Reordered Columns step? Thanks.
- Martin_WeissFeb 14, 2022Bronze Contributor
Hi copco_online ,
if it's an external stored procedure, then it might be difficult. But maybe you could try the following:
Open the Queries & Connections pane and check, if there is a connection listed there. If so, you could do a right-click on it and theck the properties.
If you are lucky, there is a connection string where you can see a SQL statement.
This could be the place where the sort order of the fields are defined.
But there is also a good chance that you do not find anything here. Unfortunately inn this case, I do not have any further advise for you.