Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

XLS to CSV and Rename Columns Automatically

  • 23-01-2017 10:40PM
    #1
    Moderators, Sports Moderators, Regional Midwest Moderators Posts: 24,069 Mod ✭✭✭✭


    Hi All,

    This has been wrecking my head, I thought I could do a little VB script but it's beyond me.

    I have an xls file (Extract.XLS) with 10 columns, (ID No.,First,Last,Addr1,Addr2,Town,County,Country,Phone,Email), I need to save the file as a CSV (simple enough Save As to Import.csv I hope) but I also need to move a couple of columns around and rename the headers (First,Surname,Payroll,Address1,Address2,City,County,Country,Phone,Email). I'd love to be able to have a way of automatically doing it but if that's not possible if there could be a nice easy way to do it without much manual intervention.


Comments

  • Registered Users, Registered Users 2 Posts: 382 ✭✭garbeth


    Will the Sb file always be in that format. Is yes then the excel file will always have the same columns in the same format. You can create a macro in excel that renames the columns to what you want them to be.

    If you have any coding experience the code behind the macro is pretty easy to rewrite if you want to add anything fancy in.

    The macro recorder basically just records what you are doing so it can be repeated when running the macro again.


  • Moderators, Sports Moderators, Regional Midwest Moderators Posts: 24,069 Mod ✭✭✭✭Clareman


    The file should always be in the same format so that's good to go, I never thought of the macro recorder option, I'll use that, thanks Garbeth.


Advertisement