Having some trouble and would like to hear some suggestions for a fix. I'm trying to use this program to extract order details from Paypal and Ebay emails for use in a spreadsheet. I can get the full plain body data from the emails, however the program throws " TypeError: Cannot read property 'toString' " whenever to gets to the toString in the first regExp variable. I've tried on just one type of email to test if it was getting hung up if it doesn't find the key words but that doesn't seem to be the issue. Any ideas on what to add/change to get it to work properly?
Hi Mr. Edwin, Thanks for seeking help here. Well, this definitely means that evaluating your regular expression fails. I believe that it is caused by receiving the PayPal/eBay emails in different format. It is possible that there are internal formatting in your emails applied by the email senders. I can help you out with this. Please send me sample emails by downloading them and attaching them in the email. My email is moa29000@gmail.com. Downloading the emails in Gmail is done as I demonstrate in the following recording: bit.ly/31sFgaJ
Hi, That totally depends on what data comes after the second line and on the email format that the email sender applies to it. Please share with me a sample email and I will help you out. My email is moa29000@gmail.com OR moayad@codewondo.com
Hi! Thank you for your videos! it helped me a lot! I have one question : Is there a function in order to use that code on the last Email received that is unread? and then marked this email read in order to allow the code to be used on the next new email that we will receive? That allow me to keep the same label all these email, and may be leave the code being autonomous
Hi, Hi, I am glad that my program helped you out. What can be done is to use dynamic filters to get the emails received in last day. Then check these emails. If they are unread, then the program reads it. That being said, I do not advise you to do so because you may receive unwanted emails that the program will eventually process. I advise you to use Gmail filters and use the label way. In case you would like to keep your label, then you can assign 2 labels, one for the program and will be removed, and another for your reference that will keep being there. Feel free to subscribe and get back to me at moa29000@gmail.com in case you need my help
This is EXACTLY what I've been looking for, thank you very much. I could use one bit of help, please. RegEx is pretty new to me, and one of my fields to match has an embedded paren, ie "Designation(s):". This breeks the match (it works if I use "Designation", but pulls the "(s)" that follows. Is the soltuion a simple modification to the RexExp for that variable? Thank you in advance
Hi Matt, I am pleased that you found it really useful. Regarding the parantheses, there are multiple ways of doing it. The simplest way is to use "Designation\\(s\\):" as your keyword. You may send me an email for any help. My email is moa29000@gmail.com. Feel free to subscribe to get updated about my new videos.
Hi Dear, Your video is so cool! I have quick question for you. Is there anyway do the same thing what you did when received new email and auto run that script? Once again appreciated your time
@@Lingkonn Hi, Yes you can actually run the script automatically based on time-driven triggers. This can be accessed from the Edit menu and then choose Current project's triggers. After that, you will be directed to a n interface to select which function you need to run and the time period. Let me know if you need help: moa29000@gmail.com
Hi, I'm running into a little issue, hope you could help. If an incoming email doesn't contain ex: "wishlistItems: "Wish List Items:" " the code runs into an error and won't import to Sheet. Is there a way to forget "wishlistItems: "Wish List Items:" " and still import what available? Also I saw Md Lingkon comment autorun the script can you share that script too? Thousand thanks for the great video very intriguing.
Hi, I'm happy that you found it useful. If you need it run without checklistItems, then you need to delete all codes that get it. The example here that I'm using in the video is for demonstration purposes and could be modified to suit your email template. For the auto run, I will guide how to do that because Auto Run triggers can only work on the account that created it, and this is why it won't work on your Gmail if I myself created it. I will help you achieve what you want so plz send me an email with a sample email to moa29000@gmail.com. Feel free to subscribe to get updated soon
Hi. Thanks so much for this video..I really hope you constantly check youR message to get a quick response. I'm looking into ONLY extracting specific information form.the body of.the emails. NOT the threads or all the email. Could you explain to me.how to do that. Thanks a lot
Hi, Have you looked at Gmail filters to assign automatic labels to specific emails? If you mean that you need to extract some specific data from an email template, you can send me a sample email at moa29000@gmail.com
Great work! Quick question, I need to separate my the name that I get, IE parse the line "john smith" into two variables John and Smith, basically breakup the full name into first and last name and have those as separate columns in my google sheets,what's the simplest way to do this?
Hi Michael, I am glad that my video is useful to you. You can separate the names by the following code: let firstName = 'John Smith'.split(' ')[0]; let lastName = 'John Smith'.split(' ')[1]; Feel free to get back to me at moa29000@gmail.com if you still face an issue. I invite you to subscribe as well.
@@CodeWondo ok so now that i've gone through your part 2 tutorial, I'm a lil unclear where and how to implement this code? Can I still use the fullname var and just split it into two strings based on the space in between, is that what those two lines do'? and if so how and where do I set them up and how do I configure those two variables properly, thanks!
Hi @superstef007ify , May I know what attachment you are interested in? Is it a text file or what? You may send me a sample email at moa29000@gmail.com
Thanks, man, that was actually very helpful! One question, if the text I want to retrieve is in the next line instead of the same line as the keyword, how would I write that code? This syntax is a bit confusing to me.
Awesome....Video ! But i want to pick up data after tab or next line instead of the same line (video timing 5:20) . so please tell me , how can we get that data...!
Bro, if I don't require the threads mails and only the first mail from the mail body than what code to use? Can I sent a format to your email, will you help me out?
Hi Sumegh, Thanks for sending me an email. I have responded to it. Please check it out. Feel free to subscribe to my channel to get updated on new videos.
Amazing tutorial! Do you happen to know how to make it automatic, so we don't have to open the sheet everyday to run it. I guess we'd have to use some Google cloud instance for that. I wonder if there is some easier and cheaper solution.
As you say in the beginning, you are not interested in the whole email, but at the end the script still prints the full content. Is there a way to print the content without the full content?
Hi, Yes, well of course I have a column to ahow the full content, however the other columns have some lead text extracted from the full content. Does thia have a answer your question?
Hi Sayaundang, In that case you would need to split the result of the regular expression and take the 2nd element of the result array. Feel free to send me an email over moayad@codewondo.com in case you still face an issue You may also consider subscribing
Hello, Great video unfortunately I am experiencing a few issues. toString seems to be deprecated. Also if the Email comes with HTML Format it does not really work. Can I send you an email with the code and maybe you can help me out?
Hi Lalo, Thank you for sharing the issue. toString is not deprecated but it is clear that there is a problem with the used regular expression. My email is moa29000@gmail.com
I am getting an odd error - my spreadsheet is just spitting out this in each Row - [Ljava.lang.Object;@59334fc6 - the last number changes per row. Thoughts?
Scratch that - I figured it out - I had brackets in this line - activeSheet.appendRow([emailDataArr]); Brackets removed and issue resolved. JIC anyone else ran across it.
Hi there, we've set up the code for this on a Google Sheet and it worked well in tests. But for some reason when we use it in a live sheet it duplicates every lead we've ever received. We only receive lead emails from one source, so all emails are under a single thread but I thought the code wouldn't be a problem here. Any ideas what is happening here? Thanks again! Your video has been a great help so far.
Hi Cody, I am very much pleased that this solution has helped you out. It's also my pleasure to help. This problem occurs when lead emails come in single threads. To solve this, replace the for loops code with the follwing snippet: for (var j = 0; j
How do I ask Google Sheets to ask for Label Name for part 2? I already followed part 1(and working!) and had previously put a label name. Great tutorial by the way sir. Very helpful.
Hi, You get the label from the dialog using the following code: var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL); var label = GmailApp.getUserLabelByName(input.getResponseText().trim()); Make sure to include these lines in your program. In fact, the spreadsheet that has the full program is attached in the description. Feel free to email me at moa29000@gmail.com if you have any problem and you may consider subscribing to my channel as well
Hi Komtris, It means that the regular expression does not match your template or that your email is not UNREAD or not assigned the correct label. Feel free to send me an email over moayad@codewondo.com in case you still face an issue You may also consider subscribing
Hi, i am getting different email format from same email id (Like Amazon), So i am getting "type Error: Cannot read property 'toString' of null".So what to do now... Please help me !
Hi Vaanika sorry that I replied late. In case you have different email formats, you may forward these formats to my email and I will look into how to parse the data for you. My email is moa29000@gmail.com
Extracting such data from a table in Gmail would require parsing your template HTML code. Since HTML formatting can widely be different from email to email based on the email provider template, I would actually need to have a sample email. You may attach the sample email here or send it to my email as a file. My email is moa29000@gmail.com. You may download Gmail emails as I demonstrate in the link below: i.imgur.com/NfwPmi3.gif
Yes it can be done. Here I am using the label method so that the previously processed emails are not processed again, hence no duplicate data is there. May I know why you do not want to assign labels to emails?
@@asyikbrowsing200 Creativesys Yes this can be done. However at the end you need to filter out emails and track the ones that have already been processed. So, the question is why do you need to make the code complex to do that while you have native Gmail filters that can filter out emails based on the desired keywords?
While running I am getting this error: "TypeError: Cannot read property 'match' of undefined" I don't know why this is happening. Can you tell me the reason
I am trying this with a complex email from my credit card company (just an alert that says how much the transaction was for). When I getPlainBody it only gives a tiny fraction of what is actually in the email. I have also tried getBody, but I can't actually parse it in GAS (Javascript). Any ideas?
Hi Steve, I am not sure if you are able to forward to me a sample email so that I can know what the root cause of the issue that you are facing is. My email is moa29000@gmail.com
@@stevegonzales4411 Well, I received your email. I worked on your problem and sent you the spreadsheet that extracts your credit card information. Please feel free to subscribe as you may like my next videos
@@CodeWondo Yep, I subscribed. There is some kind of formatting in the emails that prevent GAS from getting the body. Probably just laziness at the Googleplex; they can clearly read those emails in GMail...why not GAS?
@@stevegonzales4411 Yeah, I feel the pain and I wonder why they do not have a GAS method to read emails as how they appear in Gmail. That being said, we still have methods to get the raw data which we can manipulate until we get the desired information.
Hi, You can access it by running the program in the debug mode. Can you see the Bug symbol beside the play symbol in the code editor? It is that button that lets you run the program in this mode. Feel free to subscribe to get more useful videos
@@shushantkumar45 I developed a code to parse the data for your specific email that has a table. I spent some time last 2 days to come out with a solution. Please download the Google sheet from the following link: docs.google.com/spreadsheets/d/1NHtsdQYQt2TaRpQU403kn0ujkABnNxK3yVZfs8f8diU/edit?usp=sharing
Không được xóa: " emailData.body = message.getPlainBody();" vì sẽ không thể tham chiếu các giá trị của văn bản Câu hỏi chưa được giải quyết: Làm sao để k cần phải hiện nội dung văn bản Làm sao để dùng hàm if để xuất giá trị trong google script ví dụ như: bán là S và mua là B
Great work! I had a doubt , in my mail I get my report daily. The problem is it comes with a link not an attachment. 1) You have to click the link to download it which is mostly a zip file because of size. Do you have any idea how to automate this. Basically I need that data in a Google sheet What I have tried is this: Extracted the link in a Google sheet
Hi @Ujjwal Ranka, I'm happy that my video is helpful. I may be able to do that for you. Could you share a sample email with me at moa29000@gmail.com and let me know what data you would like to extract? Feel free to subscribe as well
I do not really recommend this at all. When you have so many emails attached to the label, then the program will take long to process the emails and detect the duplicates. I understand that you do not want to remove the label because you need them for your reference. As a solution, you can simply create a label that will only be used by the program. The other labels will not be touched and keep being attached to the emails. If that does not answer your question, please drop me an email at moa29000@gmail.com OR moayad@codewondo.com
Hi, This does not tell a lot. Can you please send me a sample email that you are trying to extract. My email is moa29000@gmail.com Feel free to subscribe as well
@@lolFunny8609 I see. This is actually possible. There's an API from Google that allows updating the spreadsheet from your Android Studio project. I will reply to you soon on this. I also hope that you can send me your email address.
@@CodeWondo what is your email address and we can talk? I am in a gridlock. The only thing I think I came up with is doing parsing email, but that would take numerous amount of time to do and I have tight deadlines
Hello, thank you very much for your great Video and Code. It is very well done and helped me a lot. I subscribed and I'm looking forward to your next videos. Unfortunately, since I'm just starting to learn coding, I have a lot of problems with getting the regular expression done right for what I try to extract from the emails I try to process. I've seen, that you've been generously helping people with their problems and would like to kindly ask you, if you could help me with my coding problem. I would be happy to hear from you.
Hi, Thanks so much for subscribing. It's also my pleasure to help you. Please email to me what problem you have with details. My email is moa29000@gmail.com
@@CodeWondo Thank you. I have sent you an eMail with the details yesterday night. My subject line is: "Your kind offer to help me with my code - regular expressions". It might have landed in your spam filter.
Hello, thank you for the video I applied your instructions and it worked. In some cases, I receive an order notification email with 2 or more items as follows: Order number: 1 Sales: $45 Order number: 2 Sales: $25 Order number: 3 Sales: $21 How to create multiple columns corresponding to the number of orders in the same email Please help me Thank you
Hi Julien, I'm glad it helped you out. To solve this, you would need some code tweaks. The problem becomes harded in case you have dynamic number of items which is actually your case. You need to loop through each one of them and refresh the emailData object at the beginning of every loop. At the end of the loop, you need to append new rows to the spreadsheet. Can you plz forward to me sample emails to moa29000@gmail.com?
O K Hi very amazing and helpful tool! Could you please give a code to get data from gmail delegate account (teams account), i.e. get aliases etc. Thanks
Hi, I'm glad that my video helped you. I am not sure if I got you correctly or not. Do you mean that you have a team Gmail account that sends and receives your emails as delegates? If so, this code in the solution should also work because all sent and received emails will appear on your Gmail account, won't they?
Hi, Thanks for prompt respond basically it is a gmail team account, I need to take emails from a label in the delegate account, i think you current code working only for your direct gmail account not for the delegate gmail account, maybe you have to use get aliases function or something Thanks in advance
Hi dear muhammad, I am also using your first name in the example haha. I am a Palestinian who studied and worked in lovely Malaysia! Feel free to subscribe to stay updated and connected
Hey, your first video worked perfectly, thanks. But this one: once I updated the code it returned the following error: TypeError: Cannot read properties of null (reading ‘toString’) at extractDetails At getGmailEmails
Hi, Thanks for posting the quesiton. The error means that your desired data that you are trying to extract doesn't come in the workable format as shown in the video. The regular expression is failing to run on the input text. For me to help, please share with me how your email looks like here or by sending me over email at moa29000@gmail.com or moayad@codewondo.com Sorry to reply late a little
Hi Moayad! Thanks a lot for this content! Is really usefull. I might need your help. I sent you a sample email to see if it is possible to extract some specific content of the email body. In my case the client information comes in the next line of the text. For example Name: John Last Name: McDondald I really hope you can help me! Thanks again!
Hi Predrag, Yes, I will help you out. It seems that your problem is with the email template. There could be some HTML formatting applied by the email sender. Sometimes parsing the HTML code is neccassary to extract the details. For me to know what causes the problem, please send me a sample email to moayad@codewondo.com and CC moa29000@gmail.com
@@CodeWondo Thank you very much for your quick reply. I just sent you the file and here comes explanation: Label used comes from mail account synced every 30 minutes(I think)to Gmail imported mails. It comes in HTML form as inquiry with fields Name , E-mail and Message (I leave it as text on sheet )but would add phone and eventually adresse. Going through the comments i saw that is kind of vanishing label. Is there a way to make it permanent and also how could I make a copy of e-mail extracted details to have archive and also further use data to send back quotes and emails. Sorry for the long explanation and hope you can help. P.S BTW you have the nes Sub. should put more similar content to YT. Best regards 😃
12:49 "I hope you're not going to fire your employee who does all of that manually" LOL
This is working great and perform as I wanted. Keep up the good work and really appreciate effort to teach us. Thank you very much.
Thank you for the feedback. Glad to help.
Plz email me if you have any issue moa29000@gmail.com
Feel free to subscribe for later amazing videos
great useful content. This is exactly what I was looking! Thanx
Glad that this helped. you. This is my target
Feel free to subscribe my channel to stay updated
Excellent work. Keep it up!
Thank you dear Omair. Glad that this helped you somehow
Awesome video man!!😁
I'm happy that you found it useful. Please subscribe to stay tuned for what's new!
Having some trouble and would like to hear some suggestions for a fix. I'm trying to use this program to extract order details from Paypal and Ebay emails for use in a spreadsheet. I can get the full plain body data from the emails, however the program throws " TypeError: Cannot read property 'toString' " whenever to gets to the toString in the first regExp variable. I've tried on just one type of email to test if it was getting hung up if it doesn't find the key words but that doesn't seem to be the issue. Any ideas on what to add/change to get it to work properly?
Hi Mr. Edwin,
Thanks for seeking help here. Well, this definitely means that evaluating your regular expression fails. I believe that it is caused by receiving the PayPal/eBay emails in different format. It is possible that there are internal formatting in your emails applied by the email senders.
I can help you out with this. Please send me sample emails by downloading them and attaching them in the email. My email is moa29000@gmail.com. Downloading the emails in Gmail is done as I demonstrate in the following recording:
bit.ly/31sFgaJ
Very Helpful thank you for making this
Thank you for your thoughts. Please let me know if you need any help and feel free to subscribe.
Email: moa29000@gmail.com
amazing work! What if I need to get some data from the body of an email which is can define by a line after a specific string?
Hi,
That totally depends on what data comes after the second line and on the email format that the email sender applies to it. Please share with me a sample email and I will help you out. My email is moa29000@gmail.com OR moayad@codewondo.com
Hi! Thank you for your videos! it helped me a lot!
I have one question : Is there a function in order to use that code on the last Email received that is unread? and then marked this email read in order to allow the code to be used on the next new email that we will receive? That allow me to keep the same label all these email, and may be leave the code being autonomous
Hi,
Hi, I am glad that my program helped you out.
What can be done is to use dynamic filters to get the emails received in last day. Then check these emails. If they are unread, then the program reads it. That being said, I do not advise you to do so because you may receive unwanted emails that the program will eventually process. I advise you to use Gmail filters and use the label way. In case you would like to keep your label, then you can assign 2 labels, one for the program and will be removed, and another for your reference that will keep being there.
Feel free to subscribe and get back to me at moa29000@gmail.com in case you need my help
This is EXACTLY what I've been looking for, thank you very much. I could use one bit of help, please. RegEx is pretty new to me, and one of my fields to match has an embedded paren, ie "Designation(s):". This breeks the match (it works if I use "Designation", but pulls the "(s)" that follows. Is the soltuion a simple modification to the RexExp for that variable? Thank you in advance
Hi Matt,
I am pleased that you found it really useful.
Regarding the parantheses, there are multiple ways of doing it. The simplest way is to use "Designation\\(s\\):" as your keyword.
You may send me an email for any help. My email is moa29000@gmail.com.
Feel free to subscribe to get updated about my new videos.
@@CodeWondo Thank you - I have sent you an email directly
Hi Matt,
I just checked the email and found it is in the spam box....I will reply it
Hi Dear,
Your video is so cool!
I have quick question for you. Is there anyway do the same thing what you did when received new email and auto run that script?
Once again appreciated your time
Code inShape I really appreciated your reply and extending your hand
@@Lingkonn Hi,
Yes you can actually run the script automatically based on time-driven triggers. This can be accessed from the Edit menu and then choose Current project's triggers. After that, you will be directed to a n interface to select which function you need to run and the time period. Let me know if you need help: moa29000@gmail.com
@@Lingkonn My pleasure dear. Please get back to me in case you face issues.
Regards
This really works. Thanks!
Glad to help you out with this. Please get back to me if anything at moa29000@gmail.com.
Feel free to subscribe as well
Hi,
I'm running into a little issue, hope you could help. If an incoming email doesn't contain ex: "wishlistItems: "Wish List Items:" "
the code runs into an error and won't import to Sheet. Is there a way to forget "wishlistItems: "Wish List Items:" " and still import what available? Also I saw Md Lingkon comment autorun the script can you share that script too? Thousand thanks for the great video very intriguing.
Hi,
I'm happy that you found it useful. If you need it run without checklistItems, then you need to delete all codes that get it. The example here that I'm using in the video is for demonstration purposes and could be modified to suit your email template.
For the auto run, I will guide how to do that because Auto Run triggers can only work on the account that created it, and this is why it won't work on your Gmail if I myself created it.
I will help you achieve what you want so plz send me an email with a sample email to moa29000@gmail.com.
Feel free to subscribe to get updated soon
Hi. Thanks so much for this video..I really hope you constantly check youR message to get a quick response. I'm looking into ONLY extracting specific information form.the body of.the emails. NOT the threads or all the email. Could you explain to me.how to do that. Thanks a lot
Hi,
Have you looked at Gmail filters to assign automatic labels to specific emails? If you mean that you need to extract some specific data from an email template, you can send me a sample email at moa29000@gmail.com
@@CodeWondo thanks so much. Sample email was sent this morning please confirm
Great work! Quick question, I need to separate my the name that I get, IE parse the line "john smith" into two variables John and Smith, basically breakup the full name into first and last name and have those as separate columns in my google sheets,what's the simplest way to do this?
Hi Michael,
I am glad that my video is useful to you. You can separate the names by the following code:
let firstName = 'John Smith'.split(' ')[0];
let lastName = 'John Smith'.split(' ')[1];
Feel free to get back to me at moa29000@gmail.com if you still face an issue.
I invite you to subscribe as well.
@@CodeWondo awesome thank you so much, I'll try it tonight, thanks again for this and the quick reply!
@@CodeWondo ok so now that i've gone through your part 2 tutorial, I'm a lil unclear where and how to implement this code? Can I still use the fullname var and just split it into two strings based on the space in between, is that what those two lines do'? and if so how and where do I set them up and how do I configure those two variables properly, thanks!
Thanks for sharing, but one question about line break. regExp = new RegExp("(?
Hi,
Line breaks can be detected by passing "/s" as a second parameter to "new RegExp". This means, the code would be like:
regExp = new RegExp("(?
Great video into Google app scripts, i am interested in extracting specific data from attachments can you help or is this your next video? Thanks
Hi @superstef007ify
,
May I know what attachment you are interested in? Is it a text file or what? You may send me a sample email at moa29000@gmail.com
Thanks, man, that was actually very helpful! One question, if the text I want to retrieve is in the next line instead of the same line as the keyword, how would I write that code? This syntax is a bit confusing to me.
@@CodeWondo Oh, I'd be very grateful if you could send it to arthurv01@gmail.com
Thanks a lot!
Hi, Arthur did your problem solved. If yes, can you mailed the code to mygreantea@gmail.com
@@CodeWondo Hey, can you send me the code for the new-line extraction as well to shaknll@gmail.com? Thanks for the tutorial!
@@Alex-ed1mr I have sent you an email. You may confirm if you received.
I appreciate it if you subscribe my channel
Same probleme haha here is my email, thanks a lot! : erwannjouault@gmail.com
Awesome....Video ! But i want to pick up data after tab or next line instead of the same line (video timing 5:20) .
so please tell me , how can we get that data...!
Did you succeed? i have the same question haha
Bro, if I don't require the threads mails and only the first mail from the mail body than what code to use?
Can I sent a format to your email, will you help me out?
Hi Sumegh,
Thanks for sending me an email. I have responded to it. Please check it out.
Feel free to subscribe to my channel to get updated on new videos.
I have responded to your email. Awaiting yours😊
Thanks in Advance!
Amazing tutorial! Do you happen to know how to make it automatic, so we don't have to open the sheet everyday to run it. I guess we'd have to use some Google cloud instance for that. I wonder if there is some easier and cheaper solution.
As you say in the beginning, you are not interested in the whole email, but at the end the script still prints the full content. Is there a way to print the content without the full content?
Hi,
Yes, well of course I have a column to ahow the full content, however the other columns have some lead text extracted from the full content. Does thia have a answer your question?
What if there are 2 words that are the same?
for example there are 2 addresses but I want to take the 2nd address
Hi Sayaundang,
In that case you would need to split the result of the regular expression and take the 2nd element of the result array.
Feel free to send me an email over moayad@codewondo.com in case you still face an issue
You may also consider subscribing
Hello, Great video unfortunately I am experiencing a few issues. toString seems to be deprecated. Also if the Email comes with HTML Format it does not really work. Can I send you an email with the code and maybe you can help me out?
Hi Lalo,
Thank you for sharing the issue. toString is not deprecated but it is clear that there is a problem with the used regular expression. My email is moa29000@gmail.com
I am getting an odd error - my spreadsheet is just spitting out this in each Row - [Ljava.lang.Object;@59334fc6 - the last number changes per row. Thoughts?
Scratch that - I figured it out - I had brackets in this line - activeSheet.appendRow([emailDataArr]); Brackets removed and issue resolved. JIC anyone else ran across it.
Hi there, we've set up the code for this on a Google Sheet and it worked well in tests. But for some reason when we use it in a live sheet it duplicates every lead we've ever received. We only receive lead emails from one source, so all emails are under a single thread but I thought the code wouldn't be a problem here. Any ideas what is happening here? Thanks again! Your video has been a great help so far.
@@CodeWondo Thanks so much - we tested the new code and it works perfectly!
Hi Cody,
I am very much pleased that this solution has helped you out. It's also my pleasure to help.
This problem occurs when lead emails come in single threads. To solve this, replace the for loops code with the follwing snippet:
for (var j = 0; j
How do I ask Google Sheets to ask for Label Name for part 2? I already followed part 1(and working!) and had previously put a label name.
Great tutorial by the way sir. Very helpful.
Hi,
You get the label from the dialog using the following code:
var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL);
var label = GmailApp.getUserLabelByName(input.getResponseText().trim());
Make sure to include these lines in your program. In fact, the spreadsheet that has the full program is attached in the description.
Feel free to email me at moa29000@gmail.com if you have any problem and you may consider subscribing to my channel as well
Hi Thank You for the tutorial
But i have an issue when i run the script it says "Script done" but nothing Exctracted can you help me?
Thank You
Hi Komtris,
It means that the regular expression does not match your template or that your email is not UNREAD or not assigned the correct label.
Feel free to send me an email over moayad@codewondo.com in case you still face an issue
You may also consider subscribing
Thanks! Great video!
You're most welcome. Glad to help
Hi, i am getting different email format from same email id (Like Amazon), So i am getting "type Error: Cannot read property 'toString' of null".So what to do now...
Please help me !
Hi Vaanika sorry that I replied late. In case you have different email formats, you may forward these formats to my email and I will look into how to parse the data for you. My email is moa29000@gmail.com
Bro, would that code work with the html formatted email?
Extracting such data from a table in Gmail would require parsing your template HTML code. Since HTML formatting can widely be different from email to email based on the email provider template, I would actually need to have a sample email. You may attach the sample email here or send it to my email as a file. My email is moa29000@gmail.com. You may download Gmail emails as I demonstrate in the link below:
i.imgur.com/NfwPmi3.gif
Could we get data from email without define label first?
@@CodeWondo i want to get email body based on keyword. so i no need to define the label name?
is it possible?
Yes it can be done. Here I am using the label method so that the previously processed emails are not processed again, hence no duplicate data is there.
May I know why you do not want to assign labels to emails?
@@asyikbrowsing200 Creativesys Yes this can be done. However at the end you need to filter out emails and track the ones that have already been processed. So, the question is why do you need to make the code complex to do that while you have native Gmail filters that can filter out emails based on the desired keywords?
@@CodeWondo solved. i've got the answer. thanks.
@@asyikbrowsing200 Great, I hope that you can also share with me what way you used? Did you use labels or what?
While running I am getting this error:
"TypeError: Cannot read property 'match' of undefined"
I don't know why this is happening. Can you tell me the reason
I too facing the same issue
I am trying this with a complex email from my credit card company (just an alert that says how much the transaction was for). When I getPlainBody it only gives a tiny fraction of what is actually in the email. I have also tried getBody, but I can't actually parse it in GAS (Javascript). Any ideas?
@@CodeWondo Just emailed. Thanks!
Hi Steve,
I am not sure if you are able to forward to me a sample email so that I can know what the root cause of the issue that you are facing is. My email is moa29000@gmail.com
@@stevegonzales4411 Well, I received your email. I worked on your problem and sent you the spreadsheet that extracts your credit card information.
Please feel free to subscribe as you may like my next videos
@@CodeWondo Yep, I subscribed. There is some kind of formatting in the emails that prevent GAS from getting the body. Probably just laziness at the Googleplex; they can clearly read those emails in GMail...why not GAS?
@@stevegonzales4411 Yeah, I feel the pain and I wonder why they do not have a GAS method to read emails as how they appear in Gmail. That being said, we still have methods to get the raw data which we can manipulate until we get the desired information.
How do you access the bottom log with the Object data?
Hi,
You can access it by running the program in the debug mode. Can you see the Bug symbol beside the play symbol in the code editor? It is that button that lets you run the program in this mode.
Feel free to subscribe to get more useful videos
One problem is there if in the body the name and phone number are in the table box format then how we will do.
@@CodeWondo I have send you the mail . Please check it and please revert on that waiting for your reply.
@@shushantkumar45 I developed a code to parse the data for your specific email that has a table. I spent some time last 2 days to come out with a solution. Please download the Google sheet from the following link:
docs.google.com/spreadsheets/d/1NHtsdQYQt2TaRpQU403kn0ujkABnNxK3yVZfs8f8diU/edit?usp=sharing
Không được xóa: " emailData.body = message.getPlainBody();" vì sẽ không thể tham chiếu các giá trị của văn bản
Câu hỏi chưa được giải quyết:
Làm sao để k cần phải hiện nội dung văn bản
Làm sao để dùng hàm if để xuất giá trị trong google script ví dụ như: bán là S và mua là B
I follow the same procedure but at the end it says finished script and nothing extracted. Please help
Can you please share with me your email template so that I am able to know what the issue is? My email is moa29000@gmail.com
Great work!
I had a doubt , in my mail I get my report daily.
The problem is it comes with a link not an attachment.
1) You have to click the link to download it
which is mostly a zip file because of size.
Do you have any idea how to automate this.
Basically I need that data in a Google sheet
What I have tried is this:
Extracted the link in a Google sheet
Hi @Ujjwal Ranka,
I'm happy that my video is helpful. I may be able to do that for you. Could you share a sample email with me at moa29000@gmail.com and let me know what data you would like to extract?
Feel free to subscribe as well
How do I remove duplicates when I don't give remove label function
I do not really recommend this at all. When you have so many emails attached to the label, then the program will take long to process the emails and detect the duplicates.
I understand that you do not want to remove the label because you need them for your reference. As a solution, you can simply create a label that will only be used by the program. The other labels will not be touched and keep being attached to the emails.
If that does not answer your question, please drop me an email at moa29000@gmail.com OR moayad@codewondo.com
Im getting undefined 0 , how can i fixed it?
Hi,
This does not tell a lot. Can you please send me a sample email that you are trying to extract. My email is moa29000@gmail.com
Feel free to subscribe as well
Can simple text data from email go directly to a simple app
Hi Judy,
What simple app do you have?
@@CodeWondo I am creating hello-world app to see if it would work. Doing it with Android studio
@@lolFunny8609 I see. This is actually possible. There's an API from Google that allows updating the spreadsheet from your Android Studio project.
I will reply to you soon on this. I also hope that you can send me your email address.
@@CodeWondo what is your email address and we can talk? I am in a gridlock. The only thing I think I came up with is doing parsing email, but that would take numerous amount of time to do and I have tight deadlines
@@lolFunny8609 Ok, please send me an email with the details. My email is moa29000@gmail.com
Hello, thank you very much for your great Video and Code. It is very well done and helped me a lot. I subscribed and I'm looking forward to your next videos.
Unfortunately, since I'm just starting to learn coding, I have a lot of problems with getting the regular expression done right for what I try to extract from the emails I try to process. I've seen, that you've been generously helping people with their problems and would like to kindly ask you, if you could help me with my coding problem.
I would be happy to hear from you.
Hi,
Thanks so much for subscribing. It's also my pleasure to help you. Please email to me what problem you have with details. My email is moa29000@gmail.com
@@CodeWondo Thank you very much for your super fast answer and your kind offer. I will send you the details soon.
@@onewiththefreaks3664 Most welcome. I will be waiting for your email
@@CodeWondo Thank you. I have sent you an eMail with the details yesterday night. My subject line is: "Your kind offer to help me with my code - regular expressions". It might have landed in your spam filter.
@@onewiththefreaks3664 Hi, yes it was in spam. I will respond to you shortly
Hello, thank you for the video
I applied your instructions and it worked.
In some cases, I receive an order notification email with 2 or more items as follows:
Order number: 1
Sales: $45
Order number: 2
Sales: $25
Order number: 3
Sales: $21
How to create multiple columns corresponding to the number of orders in the same email
Please help me
Thank you
Hi Julien,
I'm glad it helped you out. To solve this, you would need some code tweaks. The problem becomes harded in case you have dynamic number of items which is actually your case. You need to loop through each one of them and refresh the emailData object at the beginning of every loop. At the end of the loop, you need to append new rows to the spreadsheet. Can you plz forward to me sample emails to moa29000@gmail.com?
@@CodeWondo Hello.
Thanks for the quick response
I just sent you an email, hope you have a look
Thank you very much
@@julienhome8276 Thanks for sending. I received the email and I will reply shortly. Feel free to subscribe to my channel
O K
Hi very amazing and helpful tool!
Could you please give a code to get data from gmail delegate account (teams account), i.e. get aliases etc.
Thanks
Hi,
I'm glad that my video helped you.
I am not sure if I got you correctly or not. Do you mean that you have a team Gmail account that sends and receives your emails as delegates? If so, this code in the solution should also work because all sent and received emails will appear on your Gmail account, won't they?
Hi,
Thanks for prompt respond basically it is a gmail team account, I need to take emails from a label in the delegate account, i think you current code working only for your direct gmail account not for the delegate gmail account, maybe you have to use get aliases function or something
Thanks in advance
Can we get the full codes
Yes sure, you may find all links in the description
im interested when the data got Malaysia. Salam from Malaysia!
Hi dear muhammad, I am also using your first name in the example haha. I am a Palestinian who studied and worked in lovely Malaysia!
Feel free to subscribe to stay updated and connected
Hey, your first video worked perfectly, thanks. But this one: once I updated the code it returned the following error: TypeError: Cannot read properties of null (reading ‘toString’) at extractDetails
At getGmailEmails
Hi,
Thanks for posting the quesiton. The error means that your desired data that you are trying to extract doesn't come in the workable format as shown in the video. The regular expression is failing to run on the input text. For me to help, please share with me how your email looks like here or by sending me over email at moa29000@gmail.com or moayad@codewondo.com
Sorry to reply late a little
Hi Moayad! Thanks a lot for this content! Is really usefull. I might need your help. I sent you a sample email to see if it is possible to extract some specific content of the email body. In my case the client information comes in the next line of the text. For example
Name:
John
Last Name:
McDondald
I really hope you can help me! Thanks again!
Hi,
Yeah, we were in contact over email. Thanks for posting
Assalamu Alaikum WRB
Walaikum Assalam, Thank you so much bro
Really helpful, thank you!
Most welcome. I'm glad to help
I follow the same procedure but at the end it says finished script and nothing extracted. Can you please help
Hi Predrag,
Yes, I will help you out. It seems that your problem is with the email template. There could be some HTML formatting applied by the email sender. Sometimes parsing the HTML code is neccassary to extract the details. For me to know what causes the problem, please send me a sample email to moayad@codewondo.com and CC moa29000@gmail.com
@@CodeWondo Thank you very much for your quick reply. I just sent you the file and here comes explanation:
Label used comes from mail account synced every 30 minutes(I think)to Gmail imported mails. It comes in HTML form as inquiry with fields
Name , E-mail and Message (I leave it as text on sheet )but would add phone and eventually adresse.
Going through the comments i saw that is kind of vanishing label. Is there a way to make it permanent and also how could I make a copy of e-mail extracted details to have archive and also further use data to send back quotes and emails.
Sorry for the long explanation and hope you can help.
P.S BTW you have the nes Sub. should put more similar content to YT.
Best regards
😃