Forum Discussion
change positions
- Oct 31, 2017
Hello,
you can use Power Query to do that. Power Query is a free add-in from Microsoft for Excel 2010 and 2013 and built into Excel 2016 as Get and Transform.
Create a new query from a file, navigate to the CSV file and open it. Remove the columns you don't need, reorder the columns as you need them and save the query to the worksheet. Save the file as an Excel file.
Then use Save As to save the sheet with the query result as a CSV file.
When the original CSV file changes, you can open the saved Excel file, refresh the Power Query and save the query result as a CSV file again.
Hello,
you can use Power Query to do that. Power Query is a free add-in from Microsoft for Excel 2010 and 2013 and built into Excel 2016 as Get and Transform.
Create a new query from a file, navigate to the CSV file and open it. Remove the columns you don't need, reorder the columns as you need them and save the query to the worksheet. Save the file as an Excel file.
Then use Save As to save the sheet with the query result as a CSV file.
When the original CSV file changes, you can open the saved Excel file, refresh the Power Query and save the query result as a CSV file again.
- Juan Pablo GallardoOct 31, 2017Brass Contributor
And my last problem is that after I run the query I need to delete the data from the source, can I do that?
- Oct 31, 2017
Hello,
it may take a little while to get the hang of everything that can be done with Power Query.
You can transform values by creating custom columns with functions that manipulate the original data. You may need to use this technique to create a date that Power Query recognizes. Also, there is a setting to specify the locale of the original date.
You can open all files in a specific folder and combine them
You can use VBA in a workbook. Use Power Query to load the data, then use VBA to delete the data source after the Power Query load was successful.
It would be best if you started a new question about a specific problem, so that each issue can be addressed separately.
- Juan Pablo GallardoNov 02, 2017Brass Contributor
Thank you it works perfect, the only problem I have now is that when I run it on a batch, I get this error:
Could not find a package session for the given session id
This shows up when I close excel.
- Juan Pablo GallardoOct 31, 2017Brass Contributor
And also, the problem I have is that the CSV source is not one file, is one everytime someone runs a function so there could be multiple CSV files, and I need to automate this so that no ones opens it from a folder manually.....
- Juan Pablo GallardoOct 31, 2017Brass Contributor
Great thank you. I am trying it out. I dont see a way though to change the date format....