locked
Powershell txt file text to excel RRS feed

  • Question

  • I would like to be able to retrieve specific lines of text from a TXT file and load into an Excel spreadsheet.

    The file I am retrieving the text from has 5 lines of data that repeats several times in the file but each line ends with unique data. I want to be able to drop each line into a separate column in Excel. Example: Line 2 in column one, Line 4 in column two. Then every line that starts the same as Line 2 will go to column one.

    I am thinking I need to use Get-Content to grab all the text from the file but how do I find specific lines in the text and export them to an excel spreadsheet?

    Thursday, June 20, 2019 7:57 PM

All replies

  • Yes.  You would start with Get-Content.  The rest is up to you to figure out since we have no idea what is in the file or how you want to handle it.

    What do you mean by an Excel spreadsheet? What kind? Are you asking about a Csv file?

    To write to an XLS* file you will need to learn how to use Excel with PowerShell.


    \_(ツ)_/

    Thursday, June 20, 2019 8:07 PM