Hi,
I was creating an app. There are 3 output excel sheets writing to the same file. Now all the 3 sheets are coming from 3 separate data streams and are of different structure and schema. I have used block until done tools to force write all 3 sheets into the same file. Now the problem is that the output sheets are not in the expected order. It needs to be arranged in an alphabetical order. But that is not coming as expected. I can't use reporting tools as per requirement.
I was wondering if there is any VBA or batch script which could do the sorting part once the workflow has completed running. We could call this script to do this sorting. But I don’t know VBA, and the only thing which could come up by checking several websites keeps throwing me errors while running it as standalone. Can someone help me to solve the issue?
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("file path") 'insert link or URL to sharepoint document.
Application.ScreenUpdating = False
iSheets = Sheets.Count
For i = 1 To iSheets - 1
For j = i + 1 To iSheets
If Sheets(j).Name < Sheets(i).Name Then
Sheets(j).Move before:=Sheets(i)
End If
Next j
Next i
Application.ScreenUpdating = True
objworkbook.save
objexcel.quit
Hey @jaimonsk,
This looks like vbscript code and could be put into a workflow to run post the completion of the workflow.
If you click into white space on your workflow where you want this implemented, go to the configuration panel and find the "Events" tab. Once there you will want to hit add and then run command:
There are several good posts on setting up the run command for this like: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Run-Command-Configuration/td-p/469539
or you can configure it like the run command tool: https://help.alteryx.com/current/designer/run-command-tool
There are several blogs out there as well that helps configure the run command tool that could be implemented here as well.
Hi @jaimonsk,
If you would be interested there is a tool called field sort.
You can order the columns in ascending or descending order.
This tool is part of crew macro and you can download it from here: http://downloads.chaosreignswithin.com/Macros.zip