Email Extraction In Gmail to Excel

Data Gathered for D column: <[CurrentMail.Body.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries)(1)]>


C

Extracting all other data from email but on D column in excel part it stops at 300+

Hi!

I’m guessing you want to remove the ‘----’ as you’re not stating what you want to achieve.

Use a write line or a log message to print out the body, if the ‘------’ are in the body, just use yourLineAsString.Replace(“-”, string.Empty) to get rid of them?

If you’re worried you’re replacing valid ‘-’, do a check on String.IsEmptyOrNull( yourLineAsString.Replace(“-”, string.Empty))
Which will return true if you end up with an empty string.

Hello Mr Sven, The write line also dictate the same thing, I looked at the Email for those that are showing ---- and the template is the same, I am just wondering if this is a limit ?

Hi!

A limit?
Are you expecting more rows than what you’re getting?

Hello ! I double checked the email used to export those emails that are showing ------- in array(1) and just used an if for “-----” to use array(2) if it shows.

Is there probably a shorter version for this? or just use 2 if activities. The process is working now but it is sort of slow on Column D

If you just want to do it in one line you could use linq:

CurrentMail.Body.Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) _
                                        .Where(Function(line) Not String.IsNullOrEmpty(line.Trim().Replace("-", String.Empty))) _
                                        .ToArray()
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.