Extrat information from .txt file to CSV

Hello everybody I hope everything is going well

I am trying to make like an automation process of extracting information from the msinfo32.txt that is generated by msinfo32 but I am struggling a lot with the completion of this task, I hope that anybody of you can help me with this

Basically what I need is to extract the following information from the .txt file and convert it to a .csv for parsing:

OS Name
Version
Other OS Description
OS Manufacturer
System Name
System Model
System Type
Processor
Processor
Processor
Processor
BIOS Version/Date
SMBIOS
Windows Directory
System Directory
Boot Device
Locale
Username
Time Zone
Installed Physical Memory
Total Physical Memory
Available Physical Memory
Total Virtual Memory
Available Virtual Memory

I would much appreciate any help <3

Hi @fpresas78s ,

1.Read the text file by assigning String, String_var=file.ReadLines("File_Path)
2.Use “Generate Data Table” activity to generate datatable from string data.

3.Use “Write CSV” activity to write the datatable to CSV file.

Warm regards,
Nimin

2 Likes

Hello Nimin and thanks for your answer.

I am feeling dumb now, how do I do this task? “Read the text file by assigning string” I am trying to do it but I cannot find the way to do so.

Sorry for asking this is probably a dumb and basic question but I don’t know :frowning:

Thanks in advance

Hi.
Use the Read Text File activity which will store your text into a string variable. Then, you can do a number of things with that.
— if you would like to convert the string to a data table for processing in your automation, then use the Generate Data Table activity.
— if you simply want to output your text to a CSV file, then you can use the Write Text File activity using a file extension .CSV. CSVs are text files…

Or you can Generate to a data table then use Write CSV, but it’s really not needed, to be honest (like I said, CSVs are text files).

Regards.

3 Likes

@nimin @ClaytonM

Hello guys

What I am trying to do is just get certain lines from the .txt file

The .txt file can be obtained by going to msinfo32 (System Information) and then clicking on export

The lines that I am interested on are the ones I mention in the first post, this is all for parsing purporses

I am struggling since I am searching everywhere but I cannot find how to do for example the 1st step that @nimin mentions which is 1.Read the text file by assigning String, String_var=file.ReadLines("File_Path)

I am very new to all of this and I want to learn as much as I can, but this is eating my head right now sadly, for sure is a basic thing for you guys but I am struggling :frowning:

Any help will be always welcomed

Best regards

You can do the same thing with the Read Text File activity.
image

The suggestion by nimin was some scripting, which is also an option but not required.
This will return an enumerable of all the lines of text; an enumerable is basically an array.
System.IO.File.ReadLines("filepath.txt")
This will return all your text into one string.
System.IO.File.ReadAllText("filepath.txt")

You can use both in an Assign activity. If you would like more help on using scripting, let us know.

However, you don’t need to use scripting… Just use the Read Text File activity

Regards.

2 Likes

Hi @fpresas78s,

Sorry for the delay in response. I mentioned the method ‘File.ReadLines’ instead of ‘ReadAllText’ by mistake. Apologies for the confusion and inconvenience caused to you. I hope your problem has been resolved by using “Read Text File Activity” instead of ‘ReadAllText’ method. If you want to know more about ‘File.ReadAllText’, please check this out.
Thanks @ClaytonM for your clarification at the right time.

Warm regards,
Nimin

1 Like

Hello @nimin don’t worry about the late reply I understand.

Unfortunately I am not being sucesfull at the task, I mean I can read the file, I can create the table, etc… But what I need exactly is being difficult to me.

This is what I am trying to do step by step:
1.- Open msinfo32 by going to the start menu and typing it, it will open the system information window
2.- Export the information to a .txt fille or .csv file (doesn’t matter the extension)
3.- Now what I am trying to do in UIPath is to get ONLY the information that I posted on the first post into a new csv file for parsing

For me its being complicated to fulfill this task, I tried yesterday the whole day and today I am continuing with it, searching on methods, reading guides, etc, but still not sucesful

Best regards and thank you very much I really appreciate your help :slight_smile: