Powershell & Excel - Import Textfile RRS feed

  • Question

  • Hi,

    i am already creating an excel document by reading values from a textfile and writing them into an excel document, step by step. In my latest excel document, I had to create 10 sheets with around 3000 rows, each. It took for ages (almost 2 hours). Since the data is already in a textfile, I would like to import them, which, when you do it manually, takes a few seconds. But I do not want to do it manually, because I would like to create a formatted, colourful document, each time, without spending to much time on it.

    Does anyone know how to do so? Each of the 3000 rows in the textfile has five values with a ";" inbetween.

    Friday, April 16, 2010 8:58 AM


  • 1. You have a text file with 3000 rows using a ; seperator.

    2. You want to import these 3000 rows into Excel.

    3. Not only do you want to simply import the text file, but you want also want to automatically do some colorful formatting, etc?

    If that sounds about right, you'll need to describe in more detail what you want/need.  #3 can take some extra work.

    It might be a good idea to learn how to record a macro, then you have some VBA/VBScript code that can be used to model the PowerShell code.

    What version of Excel exactly?  Using PowerShell to interface directly with Excel can be relatively slow.

    • Marked as answer by Tim Quan Tuesday, April 27, 2010 7:01 AM
    Friday, April 16, 2010 12:19 PM