Jump to content

How to save text from an email into a excel spreadsheet?

angrylemon

Firstly i made a program on visual studio for my parents business to do the whole roster system on the computer, I have the email module working (where the user logs in, enters hours worked, date, ETC) and when they push the button it emails to a separate email setup for the roster system. I was wondering if there was a way to make a separate module to take the data from the email and have it automatically placed into a excel spreadsheet, In case you were wondering this is to have as little errors as possible and to make it more streamlined because i hope to sell it to the rest of the franchise.


If you guys need anything such as code or screenshots, let me know


Thanks,


Link to comment
Share on other sites

Link to post
Share on other sites

What language are you using?

Visual basic?

C#?

C++?

 

His utilization of the word 'module' leads me to suspect VB. If that is the case then you would be looking at automation using the COM interface/s office installs. This method relies on the prerequisite that office/Excel is actually present on the target system. Alternatively you can utilize a library such as SmartXLS that will work with the Excel files directly i.e. you won't need Excel to be present - although it's not free.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

You don't have to place it in a excel spreadsheet do you?

Else you can just format it right, and give it an .csv extention.

Then you can easily import it to any spreadsheet software.

Link to comment
Share on other sites

Link to post
Share on other sites

You don't have to place it in a excel spreadsheet do you?

Else you can just format it right, and give it an .csv extention.

Then you can easily import it to any spreadsheet software.

 

Or you could just go with the most pragmatic solution!

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

What language are you using?

Visual basic?

C#?

C++?

 

 

His utilization of the word 'module' leads me to suspect VB. If that is the case then you would be looking at automation using the COM interface/s office installs. This method relies on the prerequisite that office/Excel is actually present on the target system. Alternatively you can utilize a library such as SmartXLS that will work with the Excel files directly i.e. you won't need Excel to be present - although it's not free.

Yes it is vb

 

You don't have to place it in a excel spreadsheet do you?

Else you can just format it right, and give it an .csv extention.

Then you can easily import it to any spreadsheet software.

 

i don't need it to be a excel spreadsheet, just want to know how to actually access the email and its contents

Link to comment
Share on other sites

Link to post
Share on other sites

There is a way to write to files using VB but I'm not sure how you'd go about getting the text from an email

Link to comment
Share on other sites

Link to post
Share on other sites

...I have the email module working (where the user logs in, enters hours worked, date, ETC) and when they push the button it emails to a separate email setup for the roster system. I was wondering if there was a way to make a separate module to take the data from the email and have it automatically placed into a excel spreadsheet,...

 

i don't need it to be a excel spreadsheet, just want to know how to actually access the email and its contents

 

I think you really need to think carefully about what exactly it is that you are trying to ask and then pose your question again.

 

I would intemperate what you are asking thus:

I have a module that produces an email, I want to be able to pass that email to another module responsible for parsing it and producing an output.

 

If that's the case then you need to think about the interface your email module offers up first. Will it save them to disk or can they be obtained by some kind of pipeline/buffer/in memory method. Ultimately it's going to be string parsing I suspect.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

There is a api for Office related stuff available for .net you can export DataTables and List to Excell using it.

There is also support for .doc files is you want to got that route.

It is called OpenXML and there is a nice article about it on codeproject.com http://www.codeproject.com/Articles/692092/A-free-Export-to-Excel-Csharp-class-using-OpenXML

 

Writing a string to a file and saving it as a .txt can be done without any apis

 

As for obtaining the contents of a email there is a article on this to: https://code.msdn.microsoft.com/windowsdesktop/emails-using-POP3-882705d3

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×