Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

XLS to CSV and Rename Columns Automatically

Options
  • 23-01-2017 10:40pm
    #1
    Moderators, Sports Moderators, Regional Midwest Moderators Posts: 23,956 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 Posts: 372 ✭✭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: 23,956 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