This is probably the best KZbin tutorial I have ever watched. It is very clear, easy to follow and includes all the details. Excellent. I found in my application that I needed to add one more instruction. I have a source of the emails sending a message every hour and have triggered this script to also execute every hour. I found that even though the script moves the entire thread to the trash once the messages in the thread have been processed, the message that arrives one hour later and is assigned the same label is also added to the thread of all the messages in the the trash. The end result was that the script kept reprocessing all the old messages along with the new one. I had to add one instruction to process only messages that were marked as unread, i.e. "if (message.isUnread()) {". This creates one point to watch for, namely if one happens to read the message manually from the Gmail webpage, it will be marked as read such that the script will not process it the next time it executes. Also, I am not sure but the fact that new messages keep being added to the same thread which has been sent to the trash may prevent whatever timeout mechanism that normally permanently deletes messages in the trash from finally executing. After 7 days of running my script, I have 165 copies of the message in the trash. I will see if they eventually are permanently deleted. Given that Google will not allow a script to permanently delete a message, it would be good if I could automatically start a new thread periodically. I don't know how to do that without manually changing the filter that sets the label.
@alexandergrillo61184 жыл бұрын
Hi Moayad, Yes, the subject of the new messages is the same as the old. My filter to assign the label specifies the sender and the subject. The sender also sends other messages that I don't want processed with this script. That then requires that the subject be part of the filter. I believe that I have subscribed to you channel. That seemed to be the only way I could leave a comment.
@CodeWondo3 жыл бұрын
Hi@@alexandergrillo6118, I'm glad to read your complementary comment and thanks for describing how you overcome the issue. I understand your problem and kinda know the cause because I went through the same issue recently and I used your smart way too 😊. The reason behind that issue is that the new email you receive an hour after is of the same title as the previously processed trashed unread emails. So what Gmail does is group the old and new all together in one thread and hence the label is assigned to that thread back. Can you check for me if the new and processed messages have the same title or not? I would also invite you to subscribe my channel as I'm planning to post related videos later
@CodeWondo3 жыл бұрын
I have found this answer that can be used to delete trashed emails using GAS. I have not tested it yet: stackoverflow.com/a/37799896/2846743
@johnwysham57254 жыл бұрын
This work you have done is excellent. Thank you so much! Well played! Cheers
@CodeWondo3 жыл бұрын
Hi John, Thank you so much for the great support. My pleasure. You may need to get updated about my new videos, so feel free to subscribe.
@AdithyaShreshti2 жыл бұрын
This is super detailed video even for someone who is new to Apps Script. Thank you so much. I have dropped an email to you to seek a small change.
@CodeWondo2 жыл бұрын
Hi @Adithya, I have checked your email and replied to it.
@edgare.chavez60013 жыл бұрын
Thank you so much! I have been looking for so long how to get gmail iformation to this way. You are the best!
@CodeWondo3 жыл бұрын
Hi Edgar, I was glad to help and that the program is useful to you. Feel free to email me for any problems as well as subscribing to my channel.
@hsualexandre40992 ай бұрын
Great content! Nice and clear! Thank you so much 🎉
@CodeWondo2 ай бұрын
I'm happy that you found it useful and thanks for the kind feedback. Feel free to subscribe to get updated
@andrearubino62532 жыл бұрын
It was exactly what I was looking for. And the explanation was very clear, thanks!
@CodeWondo2 жыл бұрын
Hi, Thanks for the kind feedback. I'm glad this tutorial helped. You may subscribe to my channel. Feel free to contact me over email in case you have further questions. My email is moa29000@gmail.com
@notme62003 жыл бұрын
Thank you so much for this! saved me a ton of money
@CodeWondo3 жыл бұрын
You are most welcome dear! Glad this helped you save time. Feel free to subscribe to get updated about more new productivity tools.
@guibrsx5 жыл бұрын
Awesome, well explained and straightforward, good job.
@CodeWondo3 жыл бұрын
Thank you Guibson. I'm glad that it helped. Feel free to subscribe my channel for more such videos soon.
@HollisTibbettsSoftwareHollis3 жыл бұрын
Love it. This is some incredibly useful code for me. TY. Great narration/walkthru of the code.
@CodeWondo3 жыл бұрын
I feel glad to read your awesome comment. Feel free to subscribe to my channel and contact me for any help. Thank you
@evandawson10374 жыл бұрын
Fabulous! Thank you so much for sharing your knowledge
@evandawson10374 жыл бұрын
Yes I have clicked on Subscribed button... Can we also integrate google hangout with Google sheet just the way you showed the Gmail is integrated with Google Sheet. using Appscript?
@tidydeckadmin67274 жыл бұрын
Great! I love how you caused it to remove the label at the end!! Can we talk sometime?
@nareshakula49554 жыл бұрын
Good job. Very useful. Plz upload more
@nganthao88542 жыл бұрын
Your wonderful video help me a lot. Thank you very much! I have a question: Can I fetch email according to the specified time? Hope you help me answer this Q. Thanks again!
@komalkhiriya38582 жыл бұрын
Thank you so much, got ans of almost all of my qs from your video & your replies on comments.. just subscribed your channel.. Thanks again!!
@CodeWondo2 жыл бұрын
I am really glad that my coding was useful to you. That's great. Thanks for subscribing as well
@maximilianoepprecht52152 жыл бұрын
Thank you for everything!!
@CodeWondo2 жыл бұрын
Thanks for the kind words. Feel free to subscribe to my channel
@TL-uv4mi4 жыл бұрын
Great tutorial. Subscribed!!
@CodeWondo3 жыл бұрын
Thank you so much. Glad to help. Email me if you face any issue: moa29000@gmail.com
@garrettw2702 Жыл бұрын
Thanks for the great tutorial! I have two questions if you don't mind. 1) Is there a way to pull in each email separately as a message rather than a thread? In your example, the reply included the original email, I would like them separate. 2) Is there a way to pull in attachments, and possibly save them to Google Drive with a link as a cell?
@CodeWondo Жыл бұрын
Hi Garrett, Well, Gmail organizes the emails in thread/conversations. With some code twists, it is possible to exclude certain emails from being pulled to the spreadsheet based on the some conditions. For example, you can take up the first email in the thread. You can also track certain keywords like RE: or FW: to exclude the reply and forwarded emails. It is not that intuitive, but it is possible to do. Regarding the extraction of the Gmail attachments to Drive, yes it is possible as well. You need to use message.getAttachments(). Loop through every attachments and save them to Drive using the DriveApp API. The link where the attachments are saved can be pulled to the spreadsheet. Feel free to send me an email for further discussion. My email is moa29000@gmail.com
@vaclavsisl1754 жыл бұрын
Worked just fine! Thanks a lot
@CodeWondo3 жыл бұрын
Hi, I'm happy this could help you out. If you would like to watch more related videos, you may consider subscribing :)
You are most welcome dear. I am happy that my videos helped you. Feel free to subscribe to keep updated on new videos
@edcooper1471 Жыл бұрын
I keep getting the error "TypeError: Cannot read properties of null (reading 'getThreads')"
@CodeWondo Жыл бұрын
Thanks for contacting me over my blog. The issue is resolved. To help those who face the same problem, you were using nested labels and you needed to add a forward slash between the main and sub label in the code to make it work...
@byte__30762 жыл бұрын
Hi, is it possible to check the emails just in time without having to open the script, cause what I really want to do is that, when I fetch an email, I send a fetch request to my back-end service... Thanks in advice
@CodeWondo2 жыл бұрын
Hi, Yes, this can be done using time triggers in apps script. This is used to trigger the getGmailEmails functions automatically. Well, since you have your back-end service which would respond to get/post requests, then you can use UrlFetchApp to perform that... Please send me an email over moa29000@gmail.com if you would need my help with details
@anom20123 жыл бұрын
Thank you for this. Such a time saver for my business. I have a question: What if I want to change the name of the label instead of removing it?
@CodeWondo3 жыл бұрын
Hi, I'm glad that my program helped you. You can assign 2 labels; one for you that will stay and another for the program that will be removed. Renaming the label is possible but this will not help because when you rename a label, the previous name will no longer be there and the label used in the code will not work. Feel free to subscribe or email me for help at moa29000@gmail.com
@jansantos1743 Жыл бұрын
Thank you so much for this! It worked. :)
@CodeWondo10 ай бұрын
Sure. I am glad my video helped you
@reinof_ash52214 жыл бұрын
Very helpful. Thank you very much!
@CodeWondo3 жыл бұрын
Glad to hear that. Thank you for the feedback. If you need any help, please do not hesitate to email me at "moa29000@gmail.com"
@trteamlogical17434 жыл бұрын
very well friend, Good tutorial and easy to understand
@CodeWondo3 жыл бұрын
Glad to know that. You can subscribe my channel to get notified about new related videos.
@SamLee-hl7uy Жыл бұрын
Hi, thank you very much for the tutorial. I have tried to use the same in my script but it keeps saying the message.getDate(); is undefined. Do you have any ideas on it?
@lagaindra9434 Жыл бұрын
Thank you so much for the clear tutorial. Kindly need your confirmation, is this script will run automatically when there are any new incoming email?
@CodeWondo Жыл бұрын
Hi, No, you need to set up time-driven triggers so that the functions can run automatically. I have actually published a blog on how to create these triggers. Read the post here: codewondo.com/create_apps_script_triggers/ If that did not help, please send me an email at moa29000@gmail.com
@senakar98964 жыл бұрын
Hi great job, if I want as soon as I received email from specif email address, I want time and subject to record in google sheet real time will you able to help me. Thank you.
@FredySandoval_1234 жыл бұрын
This is really good stuff thanks for sharing the knowledge
@CodeWondo3 жыл бұрын
Most welcome, Fredy. Glad to have your appreciation. I invite you to subscribe so that you get notified about new related videos.
@manshitamathur18813 жыл бұрын
I dont to why but errors like Cannot read property 'getSubject' ,'getFrom' of undefined is shwowing up . Please Help me with this
@henriquefontenellegalvaodo88053 жыл бұрын
First of all thank you for your time teaching us in how to do that. How could I put a date filter in this code that allow just to get the specifc date informed in a prompt?
@CodeWondo3 жыл бұрын
Hi, I am glad it is useful to you. Do you mean you need to extract emails from specific dates only or you mean you need to filter out the spreadsheet after getting all of the emails that had the label? If you need the first, then the program needs to be updated to search for those emails only. If you need the second, then all you need is to filter the spreadsheet by date after creating column filters from the Data menu. Please email to me the details if you wish so that I know better how to help. My email is: moa29000@gmail.com
@mohamedazzouz60862 жыл бұрын
Hello thank you very much for this interesting course you really helped me. Is it possible to add the labels to sheet. Thank you
@CodeWondo2 жыл бұрын
Hi Mr. Mohamed, Yes, that is very possible if I got you correctly. You need to create a new sheet with name "Settings" as an example. Then you need to place your label in one cell. Suppost the label is in cell A1, then the code to read the label would be: let mySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Settings'); let myRange = mySheet.getRange('A1'); let myLabel = myRange.getValue(); myLabel would be your label name that you placed in A1 cell. If this is not actually what you want, then please send me an email over moa29000@gmail.com and I will help you out
@carotamayoa10 ай бұрын
Hi Thank you for this videos work great, but im having a issue, the timeout its in 6 minutes, but the amount of emails its to big so im not able to get all the info, how can I gett all the info, maybe getting from 0,200 then 200,400 how can i do that, please help
@CodeWondo10 ай бұрын
Thank you for posting this comment. I'm glad my video helped and I hope you can subscribe to get updated on new videos. Well, you actually need to read the emails in batches using one of the following methods: getInboxThreads(start, max); search(query, start, max); The *start* is actually the index of the first email and the *max* is the number of email thread you want to extract in one call. Each time you execute these commands, you need to update the start index and save it. You can get up to 500 emails in one call and you will also face the problem of the timeout. To solve this, you need to make the *max* as low as possible and you also need to schedule email extraction by using automatic apps script triggers. That actually is not an easy task but with carefull development, it can be achieved.
@shahgmail Жыл бұрын
Hi there. There is a flaw in this. After you run your function and the label is removed from the thread, Pls send another email that qualifies to be in the same thread. What you will find is gmail will add your new message to the existing thread with the previous messages. And because of the label filter rule the label is re-assigned to the thread (which containes the previous mesages). So what youll find is your function will write your previous messages again and the new message. Pls test this scenario. Im not sure what the solution is.
@CodeWondo Жыл бұрын
Hi, Well, you're right and this was fixed long time ago in the published GitHub code and CodeWondo blog. Please check the description to get the code that fixed it or send me an email over moa29000@gmail.com
@suhasdeore32883 жыл бұрын
Woooww..simply amazing...u make lyf so easy🙏
@suhasdeore32883 жыл бұрын
@@CodeWondo wht do i want to make chnges in code if i want to fetch only same day data.
@CodeWondo3 жыл бұрын
@@suhasdeore3288 I guess that you would like to have a daily order processing. I have done such project before. Please email me the details at moa29000@gmail.com
@paulapoblete10902 жыл бұрын
Nice! I have conversations turned off, should I still ask for threads? Also, how can I lean more about this. I used to code a couple decades ago so I understand the basics
@CodeWondo2 жыл бұрын
Hi Paula, Conversations view does not affect the functionality and the codes behind. It is just a viewing option. So when it is turned off, the threading mechanism is still there but not viewable. With regard to learning more about the Apps Script and its coding, you can read Apps Script references from Google website. They provide good simple examples for all supported services: bit.ly/3P4JJX9 You may also send me an email over moa29000@gmail.com for help. Please consider subscribing as well.
@user-tp6yy5wp9c Жыл бұрын
Thank you for this video! I don't even code and got my script to work. I have 2 questions, how can I trim the subject where I can remove 8 characters from beginning and I would like to join two field such as Street and City in one column on my google sheet
@CodeWondo Жыл бұрын
That's nice Well, you can remove the first first 8 characters by using: myString = myString.substring(8); You can also combine 2 strings by: myString1 + myString2 Feel free to send me an email over: moayad@codewondo.com You may consider subscribing as well
@amandaalves68974 жыл бұрын
Hi! Nice video, thanks for sharing! There's a way to do that but using the subject email instead of a specific gmail user?
@CodeWondo3 жыл бұрын
Hi Amanda, Yes that can be done. If you would like the subject email, then you need to add a filter based on subject title not sender email. I may send the way in details to your email. You may send me at: moa29000@gmail.com
@DeepakKumar-oy7io4 жыл бұрын
Hi Moayad, Thanks for the code. I am just trying to automate the process wherein Spreadsheet syncs automatically using trigger with gmail on minute by minute basis to check the mails with predefined labels and list the same in the spread sheet. Can you let me know how to tweak the code to make this happen?
@CodeWondo3 жыл бұрын
Hi Deepak, Sorry to reply late. You can achieve this by using time-driven triggers from the Resources menu in the Google App Script Editor. I will try to make a video on time-driven triggers later however, for now, here is a link that would be helpful.: www.quora.com/How-can-I-periodically-run-a-Google-Script-on-a-Spreadsheet
@hemraz.ramchurn2 жыл бұрын
Hi Moayad. I will be grateful if you can provide me a code to retrieve threads from a label for a specific date range. for example for November 2021, only for this month. Thank you
@CodeWondo2 жыл бұрын
Hi there, Sorry to reply late to you. Well to be able to retreive the threads filtered by dates. You can use the following code: var input = ui.prompt("Enter Receipt date since when you would like to import mails. [yyyy/d/m]") var date = input.getResponseText() var threads=GmailApp.search('after:'+ date); Note: the date format should be yyyy/d/m. Please let me know if you face a problem over email as an easier channel for communication. My email is moa29000@gmail.com
@hayat_soft_skills3 жыл бұрын
Wow !!!! Thanks! for making this! Question: who i will write regular expression for this example: customer no: 1234 on basis of colon how i will get 1234 number mean new line text
@CodeWondo3 жыл бұрын
Hi, Most welcome. You can add the following as a parameter to the RegExp object: "s" Feel free to subscribe and contact me over email moa29000@gmail.com if you need my help
@mohdnazrinsharudin27303 жыл бұрын
Hi there! Thanks for sharing this! I'm sorry as I'm still new to AppScript, is there a way to extract the email content if it comes in HTML format body? Appreciate your advice of this!
@CodeWondo3 жыл бұрын
Yes, but it all depends on how you customize the code so that the desired data is extracted out of the HTML code. In fact, there is a method which extracts emails in HTML format which is getBody(). You can read about it here in the documentation: developers.google.com/apps-script/reference/gmail/gmail-message#getbody Feel free to email me a sample message and I will help you out. My email is moa29000@gmail.com
@taimoorashiq62304 жыл бұрын
Hi, Thank you are big help. I was looking for such thing for quite a long time. Can you help me with one thing, how to get the first email of the thread only? I don't want whole thread, just the very first email with sender, date, subject & all the labels it has? your reply is very much appreciate.
@CodeWondo3 жыл бұрын
Hi, yes you can simply process the first message pulled by the getMessages. It will be in the first index of this array
@rankaujjwal4 жыл бұрын
Hey, first of all thanks for the videos , they are so neat and easy to understand. I had a small doubt. Even if I exactly copy your code, I get an error at the get function. The error is TypeError: Cannot read properly 'getDate' of undefined(line..). The same thing happens for all the functions can't read getPlainBody properly
@rankaujjwal4 жыл бұрын
@@CodeWondo Thanks for the quick response. Checking it .
@CodeWondo3 жыл бұрын
Hi, I suspect that the "message" object is not correctly defined. Double check that you are using the correct variable with the exact spelling. If the problem persists, please share with me your spreadsheet to my email moa29000@gmail.com
@khursheed65872 жыл бұрын
Thank you :)
@CodeWondo2 жыл бұрын
Most welcome. Feel free to get back to me over email if you have any questions. My email is moa29000@gmail.com
@violetgrows Жыл бұрын
newbie here. Can you tupe the code on the heading so I could just cut & paste? I want to transfer emails to a google sheet, to include all info expecially body containing communication content. Thanks.
@CodeWondo Жыл бұрын
Hi there, Yes sure, it is in the following link: codewondo.com/gmail-emails-to-spreadsheet/ Feel free to send me an email for any help. My email is moa29000@gmail.com
@anzel06274 жыл бұрын
Cool Stuff! Congrats!
@CodeWondo3 жыл бұрын
Most welcome...
@saratbushan3 жыл бұрын
Hi. I am sorry to report the code is not working but more importantly Because of accepting the project request on the same day and within hours My Evernote account and gmail account was hacked. Request to check security settings before sharing the project
@CodeWondo3 жыл бұрын
Hi, I cannot understand your security concern and the issue that you are facing. Please let me know what error are you facing and how does the code not working.
@munjid29095 жыл бұрын
very nice and detailed. but I think its for the high level :)
@mejoreswebchile6 ай бұрын
Thank so much, but why if i have 10 emails with one label then why the script writte 30 rows or more in my sheet date? I think if the label gmail have 10 emails then should writte 10 rows in the sheet paper. Thank you so much again.
@CodeWondo6 ай бұрын
Hi, I'm glad my video helped you. I believe that inside of your emails, there are replies or that your emails are organized in threads (conversations) and you have more than one email in your labeled threads. You may send me an email over moa29000@gmail.com (cc moayad@codewondo.com) and I will reply to you within a day. Feel free to subscribe
@fouadabdeen4 жыл бұрын
Great. Keep it up.
@malehmovic3 жыл бұрын
I am unable to get the email by using the code. Need some help to where I did wrong
@CodeWondo3 жыл бұрын
Hi Aizat, Can you explain what your problem is? You may also email me sample emails by forwarding them to me at moa29000@gmail.com. You may better download an email as I demonstrate in the animated image below: bit.ly/31sFgaJ Feel free to subscribe to my channel as well so that you get update about awesome solutions.
@malehmovic3 жыл бұрын
and also the script is running but nothing appears in the google sheet but the email is missing from the mailbox. is that supposed to happen?
@CodeWondo3 жыл бұрын
@@malehmovic Do you mean that the label is removed but no data is pulled into the spreadsheet? Please send me a sample email to my address as I guided in the previous comment.
@prayagrajchaudhary5893 Жыл бұрын
Keep posting
@CodeWondo Жыл бұрын
Thanks. I am glad my videos helped. Feel free to subscribe to get updated with new videos
@cynthiagovreau60193 жыл бұрын
I clearly did something wrong - I copied the script - changed the label and all the message in the label are gone - any ideas - nothing appeared in the spreadsheet
@cynthiagovreau60193 жыл бұрын
I figured it out - I have to set the messages as unread!!!!!
@CodeWondo3 жыл бұрын
@@cynthiagovreau6019 Yes dear Cynthia. Glad that this video is useful to you. Feel free to email me if you have any issues at moa29000@gmail.com
@BRANNDON10002 жыл бұрын
Thank you very much ir helped me a lot. Do you know how to actívate the automated function, I want it to be automatic and it is already configured for every 5 minutes, but it is actually triggered, but it does not bring the data.
@branndonalexisquinterolope9982 жыл бұрын
Exception: No se puede usar SpreadsheetApp.getUi() desde este contexto.
@donatogerardosassone54193 жыл бұрын
If we have an email message with a previous conversation, the Google script pastes all the related emails of the conversation. I ask you if there is there is a way to paste only the last message of the conversation.
@CodeWondo3 жыл бұрын
Hi Donato, Thanks for asking. So what you mean is that you want to discard the quoted text that comes with email as a result of replying or forwarding previous emails. This is possible by parsing the email data and removing extra texts in code. Could you send me a detailed explanation to my email and I would look into it. My email is moa29000@gmail.com
@gimmygay6012 жыл бұрын
Thank you ☺
@CodeWondo2 жыл бұрын
Most welcome. I am glad that my video helped. Feel free to subscribe to get updated on new useful videos
@kevinbryant692 жыл бұрын
Hi, wonderful lesson. I have run into trouble that I can not figure out. 1st let me say I know nothing about scripting/coding. I just tinker with what others have done to make it work for my needs. So it may be something very simple. I can run the script and it will populate a few entries but then stops. I have over 2000 emails to harvest data from. Would you have time to look at my code? I dont want to just post it here willy nilly.
@CodeWondo2 жыл бұрын
Hi Kevin, Definitely, please send me the details over email at moayad@codewondo.com
@HomeWorkout6192 жыл бұрын
Hi Thank you For Sharing this how to get mail automatic instead of click on Gmail manager and I want to fixed my label plz suggest me how can I trigger for the same
@CodeWondo2 жыл бұрын
Hi, You can create time-driven triggers by following the steps below: * Go to the Apps Script editor: * Go to Triggers which is an option on the left side panel (clock icon). * At the bottom-right side, click on the button Add Trigger. This opens a dialog. Set the options as follows: * Choose which function to run: getGmailEmails * Choose which deployment should run: Head * Select event source: Time-Driven *Select type of time based trigger: Day Timer * Select time of day: choose your time interval. * Repeat the last step again for whatever time you would like. Feel free to send me an email moa29000@gmail.com
@CodeWondo2 жыл бұрын
@Tonatiuh Isaac Viveros Chavez Gracias por suscribirse
@aridavis38842 жыл бұрын
Is it possible to read data from google sheets, to send an email if a specific condition from the google sheets data is met?
@CodeWondo2 жыл бұрын
Hi Ari, Yes, this can be done and automated. You can set up Google cloud triggers or add buttons to a customized Google sheet interface and initiate reading the specific sheets and send emails using Spreadsheet API and Gmail API. You can focus on GmailApp.sendEmail() function. You may read more from the following link: bit.ly/35ib46N Feel free to send me an email over moa29000@gmail.com for help...
@javiera.palaciosc15153 жыл бұрын
Hi, Friend Thanks a lot for you code, I have used and it works well, but I have a question, How can I get only the last message of the threads, in your example will be the second one wich has both(First email and its anwers), could you help me with that,. Regards from Colombia.
@CodeWondo3 жыл бұрын
Hi Javier, I have replied to your email. BTW, you can get the last message by using the following code inside of the first for loop: var messages = threads[i].getMessages(); var message = messages[messages.length - 1]; if (message.isUnread()){ extractDetails(message); GmailApp.markMessageRead(message); }
@user-zo5yg5yg7q4 жыл бұрын
Hi! Your video is very helpfull)) thanks for the tutorial! But when I try to start The script, I get a error "TypeError: Cannot read property 'getThreads' of null". How I can fix it? (sorry for my not excelent english)
@user-zo5yg5yg7q4 жыл бұрын
or "TypeError: Cannot read property '0' of undefined"
@CodeWondo3 жыл бұрын
@@user-zo5yg5yg7q Hi, I'm glad to help :) The error is because the label that you enter does not exist. Make sure to key in the exact same label as the one on your email. You may also email me a sample email so that I help you further. My email is: moa29000@gmail.com. Plz feel free to subscribe
@muhammadjamshed74453 жыл бұрын
Hi, Thank you so much to making this video it is very useful. Can you please share this code.
@CodeWondo3 жыл бұрын
Hi Muhammad, You are most welcome. Yes, please send me an email and I will share it with you. My email is moa29000@gmail.com Feel free to subscribe...
@kritika001ify2 жыл бұрын
Thanks for sharing ! Can you also share a code to download csv attachment from gmail to google drive and the. Opening the files to copy last 8 rows and append data to master sheet
@CodeWondo2 жыл бұрын
Hi, To download csv files, you can actually get the attachments using the following method: let myAttachments = message.getAttachments(); This will return to you all the attached files. You can then save this file to your Drive folder with ID using the following code: let myFolder = DriveApp.getFolderById('xxxx'); myAttachments.forEach(attachment => { folder.createFile(attachment .copyBlob()).setName(attachment .getName()); }) This will copy the attachment files to your Drive folder. Regarding copying the 8 rows, I actually did not understand well. If this reply did not answer your questions, please drop me an email and I will happily communicate with you. My email is moa29000@gmail.com
@rouelsatojr.28274 жыл бұрын
Hello Sir. I would like to ask some question. I have created a script o send email from google sheet to gmail. But I'm having trouble because the email generated by the script does not insert on the same subject. hoping you can help me and thank you
@CodeWondo3 жыл бұрын
Hi Rouel, I am not sure if I understood the problem well or not. Is it that you are trying to send automatic emails with different subjects but the emails sent are still having the same subject? You may send me an email that describes your issue and I will definitely help you out.
@artybluegirl4 жыл бұрын
Thank you so much
@CodeWondo3 жыл бұрын
Glad to have your positive comment. My next soon video will be on how to extract data from the email body. You may subscribe to get updated
@francismata44924 жыл бұрын
can we mail merge with images ? and how?
@Jonathanjohansson063 жыл бұрын
Is it possible to get emails from only a certain time period, for example only the last week?
@CodeWondo3 жыл бұрын
Hi, yes this could be done by using gmail search method to filter out last week's emails. Please see the link below that explains it: developers.google.com/apps-script/reference/gmail/gmail-app#searchquery Feel free to subscribe and get back to me at moa29000@gmail.com
@owenbt3 жыл бұрын
how can i export the table inside the gmail to google sheet? it shown me TypeError: Cannot read property 'getThreads' of null
@CodeWondo3 жыл бұрын
Hi, If you mean that you would like to export data from the tables, then this is highly dependent on the format of your email. Data extraction out of Gmail can be done by looking at specific keywords and parsing the data accordingly. I need to see how the email looks like. You may send me a sample email to moa29000@gmail.com
@shane45220914 Жыл бұрын
Thank you.
@CodeWondo Жыл бұрын
Most welcome. Feel free to subscribe to my channel. You may also send me for help at: moayad@codewondo.com
@surjantojayarental91412 жыл бұрын
Great sample code. i have been test and working fine with this code. Anyway Is it possible to also insert to external database ( sql server ) ? kindly help ... keep your good work Brother.
@CodeWondo2 жыл бұрын
Yes, this is possible using the Apps Script JDBC service. You may read more about it from the following link: bit.ly/3aNSZx2 Feel free to email if you need any help over moa29000@gmail.com
@tuskdocumentation4976 Жыл бұрын
Hello.. it ran smoothly.. How to put email message link instead of bodyContents? it takes a lot of Row space.
@CodeWondo Жыл бұрын
Hi, getting the email links is possible with some tweaks. The link needs to be constructed from a base link that has includes the attached label as well as the user ID. Please drop me an email at moa29000@gmail.com and I will help
@JasvirSingh-wr4qe Жыл бұрын
Thank you for your video. I have one query , I set trigger to automate function but every time it runs I am getting emails in sheet automatically but with all older email too those are already present in sheet. Actually I want only new emails come into sheet.
@CodeWondo Жыл бұрын
I guess you forgot to remove the label from the processed emails. Can you please share with me your spreadsheet which has the program? My email is moa29000@gmail.com Feel free to subscribe to my channel so that you get update on new videos
@JasvirSingh-wr4qe Жыл бұрын
@@CodeWondo brother thank you so much you solved my query as I shared sheet with you. Thanks a lot.😊👍
@CodeWondo Жыл бұрын
@@JasvirSingh-wr4qe You are most welcome. I am glad to help...
@vincearcher Жыл бұрын
@@CodeWondo Hi. Very interesting stuff, thank you' I'm interested with this issue. Can you help me with this ?
@komalkhiriya38582 жыл бұрын
This is super helpful... Thank you so much!! QQ : Is there any way to check in Gmail shared mailbox that who has moved the emails from main inbox to different labels if there are multiple users? Thanks again
@CodeWondo2 жыл бұрын
Hi Komal, Do you have a Drive account for the shared inbox or not? If yes, do you have access to it?
@komalkhiriya38582 жыл бұрын
@@CodeWondo I tried to see but it was taking me to my personal account only.. no drive found.. This shared mailbox is delegated by someone to 8-9 people... We can see who has responded from shared mailbox but can't track who has moved the emails from main inbox to different labels....
@CodeWondo2 жыл бұрын
@@komalkhiriya3858 I believe that there is a twisted way of doing that by creating a web app using Google Apps Script. However, I do not have the resource to develop and test it since I am not a G-suite/G-Workplace user. Shared inboxes are only available in this kind of accounts not in personal accounts. Feel free to drop me an email at moa29000@gmail.com in case you have details you would like to share with me
@ajnaveen4 жыл бұрын
Hi, Thanks for the Script. Need one change in the code. I don't want it to apply only for unread messages and once the label is removed, i want to add a different label, so that it will still help me to filter the mails later. Please help.
@CodeWondo3 жыл бұрын
Hi Naveen, You are welcome. Sorry for the late reply. Are you still facing the issue?
@alejandrosalazarguerrero19646 ай бұрын
Hi friend could you help me please Appears: TypeError: Cannot read properties of undefined (reading '0')
@CodeWondo6 ай бұрын
Hi, Thanks for commenting. Sure, I'll help you out. I believe that your email format is not similar to the one I demonstrated here in the video. Can you send me a sample email to moa29000@gmail.com and cc moayad@codewondo.com ?
@jomythomas16062 жыл бұрын
Hi Moayad.. Thanks. how do i modify this code to get a user input date and get emails only for the input date?
@CodeWondo2 жыл бұрын
Hi Jomy, What you want can be done using the Gmail filters. Suppose you would like to extract inbox emails which arrived on 9/1/2022, then the code to get all threads would be: var threads = GmailApp.search('in:inbox newer:2022/01/9 older:2022/01/10 '); instead of the code: var threads = label.getThreads(); If you found difficulties, feel free to get to me over email. My email is moa29000@gmail.com Feel free to subscribe as well.
@jomythomas16062 жыл бұрын
@@CodeWondo Thankyou for your prompt response. Actually my query was to pass the date using a user input like a ui.prompt. could you suggest how to do it.
@jomythomas16062 жыл бұрын
I wrote the below line but it does not return result: var input= ui.prompt("Enter Receipt date since when you would like to import mails. [yyyy/m/d]") var threads=GmailApp.search('after:'+ input);
@CodeWondo2 жыл бұрын
@@jomythomas1606 The format should be yyyy/d/m not yyyy/m/d. You can use the following code: var input = ui.prompt("Enter Receipt date since when you would like to import mails. [yyyy/d/m]") var date = input.getResponseText() var threads=GmailApp.search('after:'+ date);
@jomythomas16062 жыл бұрын
@@CodeWondo It worked like a charm. Thanks a lot Moayad!
@rakanshmohnani76362 жыл бұрын
Thankyou so much for the video, I have attachment links in mail body, I'm not able to get that hyper links in body, Could you please help me with that??
@CodeWondo2 жыл бұрын
I'm glad that my video helped. Please send me sample email over moa29000@gmail.com so that I am able to know what the cause is.
@akinvasion2 жыл бұрын
Thankyou for this wonderful script. Whenever I am running the script I am getting the Body Text in html format. Please advise.
@CodeWondo2 жыл бұрын
Hi, I'm glad that you found my video useful. Are you using messahe.getBody() instead of message.getPlainBody()? Please forward to me a sample email so that I'm able to help you out. My email is moa29000@gmail.com. You may subscribe as well to get updated on new videos
@CodeWondo2 жыл бұрын
Hi, I am not sure if my guidance was useful to you. Please let me know
@LuisLopez-sc1qc3 жыл бұрын
hi , very much your work
@CodeWondo3 жыл бұрын
Glad to help. Thanks for the positive feedback. Feel free to subscribe and contact me in case you have any problem. My email is moa29000@gmail.com
@mailysbataille2674 Жыл бұрын
Hello, you say that it is possible to extract only some information in the body contents. Can you explain how is it possible to do that ? For example, i would like to extract only the first and the three last lines of my email. Is it possible ?
@CodeWondo Жыл бұрын
Hi, Well, it's possible to extract almost any details from the email with some code tweaks. There's no standard way to do that as the code is customized to your email template. Please send me a sample email to: moayad@codewondo.com And CC moa29000@gmail.com I'll help you out with it
@jeanfrancoiscarre2 жыл бұрын
Hi Code Wondo, you're demo is awesome, thank you... About the "GetFrom" to get the email... do you know how to get "only" the email ? With no other details, just the email please ?
@CodeWondo2 жыл бұрын
Hi Jean-Francois, I have worked it out for you. Please use the following code snippet (you will get the sender name in senderName variable and the sender email in the senderEmail variable: let emailSender = message.getFrom(); let params = ['(?
@arnellcarmichael635 Жыл бұрын
Well done! Is there any way to reach out for a specific script I need written?
@CodeWondo Жыл бұрын
Hi, Yes, I am open for that. Please send me an email over: moa29000@gmail.com and CC: moayad@codewondo.com
@arnellcarmichael635 Жыл бұрын
@@CodeWondo will do! It will be from an info@ email address with a Loom video attached. Thanks so much!
@CodeWondo Жыл бұрын
@@arnellcarmichael635 Sure, I will check it out...
@ShubhamKumar-ls9cz Жыл бұрын
Will you please help me out with the changes needed to extract Sent mails list with same label?
@CodeWondo Жыл бұрын
Hi, Yes, please send me details over email at moa29000@gmail.com
@ShubhamKumar-ls9cz Жыл бұрын
@@CodeWondo Just now sent a mail with Subject "Want to extract Sent mail Email IDs [Shubham]"
@CodeWondo Жыл бұрын
@@ShubhamKumar-ls9cz Alright, I have checked it and replied to it. Please check your inbox.. Feel free to subscribe to my channel to get updated about new videos
@ametuniv51064 жыл бұрын
Hi, thanks for the tutorial, I tried your code but it seems some issue with it, the script is running but not fetching any data please help
@CodeWondo3 жыл бұрын
Hi, Make sure that you insert the correct label exactly as it appears in Gmail. You can also use the debug mode to track the execution of the script. I would invite you to subscribe if you have interest to learn more about Google App scripting
@lukaszika35272 жыл бұрын
Hi is it possible to get specific parts of an e-mail body to the different columns of the sheet? I mean can I get for example something on line 5 of the body after part of the text? (E.G.: Phone: 555555555) is it possible to get just the “55555555” from that e-mail body? Thank you!
@CodeWondo2 жыл бұрын
Hi Lukas, Yes that is very possible. Based on this example you mentioned, you can use regular expression to get the text as I explain in the video: kzbin.info/www/bejne/pHqUgHtppaatbNU That being said, it actually all depends on the email template that you're receiving. Can you send me a sample email to moa29000@gmail.com? You can download your sample email and attach it as a file in the email as I demonstrate in this animated image: bit.ly/31sFgaJ
@shubhamsawant18504 жыл бұрын
Sir, I am not able to fetch emails because apparently getDate(), and all other following functions in the extractEmail() are not being able to be called. Please help
@CodeWondo3 жыл бұрын
Hi, does it show any error? How did you know that getDate is the problem? Did you use Debug mode?
@richnuwa153 жыл бұрын
@Code inShape I have some emails missing from my extraction but don't get any error. Out of 682 emails in a label/folder, am only getting 512 . Any ideas on how to resolve this?
@richnuwa153 жыл бұрын
@@CodeWondo Thank you so much. God bless you for your will to help us all.
@CodeWondo3 жыл бұрын
@@richnuwa15 This is probably because you have hit the quota limit that Google allows its users. What I suggest you to do is to run the script gradually over wide time intervals. You can also read my comment to another person who faced the same issue here: gist.github.com/MoayadAbuRmilah/5835369fdebbecf980029f7339e4d769#gistcomment-3451315
@pogianima73482 жыл бұрын
good day. how about to get emails based on between two dates.
@CodeWondo2 жыл бұрын
H Pogi, Since we are using labels in this video to get the threads as in the following line, then we need to change the way to get those emails within specific dates. Code to Remove: ---------------------------------------- var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL); if (input.getSelectedButton() == ui.Button.CANCEL){ return; } var label = GmailApp.getUserLabelByName(input.getResponseText()); var threads = label.getThreads(); ---------------------------------------- To get the emails between two dates, we can get the threads using Gmail search engine. Suppose you want to get emails from 1 Oct 2021 to 11 Oct 2021, then you need to replace the above 2 lines with the following: Code to Add: ---------------------------------------- var threads = GmailApp.search('After:2021/10/01 AND Before:2021/10/10');
@dawidslesinski37852 жыл бұрын
@Code Wondo i have error "Cannot read property '0' of undefined" lebel is exactly the same as in the e-mail. I will be grateful for your help
@CodeWondo2 жыл бұрын
Hi Dawid, This error is tricky. It could be due to internal email formatting. Please forward to me a sample email to moa29000@gmail.com so that I am able to know what the cause is.
@dawidslesinski37852 жыл бұрын
@@CodeWondo I left a reply to @ I will be grateful for your help :)
@CodeWondo2 жыл бұрын
@@dawidslesinski3785 Yes Dawid, I have droppped you an email as a reply with the solution to your problem.
@surveillancemenrocks40314 жыл бұрын
How can i set it to run automatically? Triggers are not running as well. getting error rate 100%
@CodeWondo3 жыл бұрын
Hi Manoj, Could you share with me your sheet so that I help you solve the issue? My email is moa29000@gmail.com Plz consider subscribing
@johnatbnl8622 жыл бұрын
Script Editor does not show in my Tools drop down menu. There is an Apps Script under Extensions, but it gives me this message: "Sorry, unable to open the file at this time. Please check the address and try again." HELP please!
@CodeWondo2 жыл бұрын
Hi John, Yes, there is a new update on Google Sheet interface and menus. Regarding the error, I guess it is because you are logged in to multiple Google accounts in the same browser. Log off from all your accounts and log in back to only the one that you want your program to work on. Feel free to subscribe to get updated about new videos. You may also reach me over moa29000@gmail.com for help
@taimoorashiq12633 жыл бұрын
Can you help me with a code for gmail? I am trying to find emails that i forgot to respond. All those emails in which i am not the last responder.
@CodeWondo3 жыл бұрын
Hi Taimoor, It is actually tricky and challenging but it is possible. The key here is to track emails that has keywords for replying like RE: and search if last email sent is by you or not. I am able to develop this solution for you. Please send me an email at moa29000@gmail.com Feel free to subscribe to my channel as well.
@sarahclark47783 жыл бұрын
Hi. I am trying to copy and paste the code. I changed the entered the name I used for the label and when i select Get Emails by Label button on Google Sheets, it prompts me to type in the label name. When I type the same label name that I did on the code, it runs the script and finishes but no emails are added. i double checked and I have emails in that label on my gmail. Please help me with this if you can.
@CodeWondo3 жыл бұрын
Hi Sarah, If the label is still there assigned to some emails, then I guess the label that you key in the prompt box is actually different than the one assigned to the emails. Can you send me your code to my email so that I check it for you: moa29000@gmail.com
@danielgarciaclaver34473 жыл бұрын
Hello! Great job! I have a doubt: the script works perfect. I need to make it run automatically every 5min. I tried with the triggers but it does not work as I still need to add manually the label in the createdmenu. Is there anyhow you could help me? Thanks!
@CodeWondo3 жыл бұрын
Hi Daniel, Well, you only need to replace the text "ToBeProcessedByGAS" to your label. You can assign a label automatically using Gmail filters as well. Please let me know if you face a problem or contact me over moa29000@gmail.com You may consider subscribing my channel for new video updates
@CodeWondo3 жыл бұрын
@@aashishkukreti5720 Hi, I have made a screen recording which would guide you how to create time-driven triggers so that the script can run automatically. Here is the link for the recording: bit.ly/3mOSaYM Please send me an email if you still face an issue. My email is moa29000@gmail.com
@CodeWondo3 жыл бұрын
@@aashishkukreti5720 That's awesome. I am glad to help and yes, get back to me any time. Feel free to subscribe my channel as well
@mystrymen2 жыл бұрын
How can we fetch table formed reports from Gmail.
@CodeWondo2 жыл бұрын
Hi Brandsman, Well, table formatted emails are kind of challenging because the HTML code needs to be parsed and not simply the text. Please forward to me a sample email and I will look at it for you. My email is moa29000@gmail.com OR moayad@codewondo.com Here is a demo video that I published where table emails are extracted to spreadsheets: kzbin.info/www/bejne/gni8qYKnpL58eK8
@tuskdocumentation4976 Жыл бұрын
when i run script. it says thread is not a function.. how to fix this? tnx
@CodeWondo Жыл бұрын
Hi, Please send me a picture of the error to my email and I will help you out. My email is moa29000@gmail.com
@jfresh20544 жыл бұрын
I got the code to work. is it possible to set a trigger to automatically update the spreadsheet either by when the label is created or when I open the spreadsheet? I prefer to not press a button for it to update. I just want it to update automatically.
@PaulBarleyChito3 жыл бұрын
@@CodeWondo Can you also send me the code? I also prefer to not press a button for it to update. I just want it to update automatically. Thanks!
@PaulBarleyChito3 жыл бұрын
@@CodeWondo Hi Code, copy that. I sent you an email. Thank you! :)
@CodeWondo3 жыл бұрын
Yes the link for the full code is in the video description. Please let me know if you have any issue by sending me over my email moa29000@gmail.com Feel free to subscribe as well so that you get updated on awesome business solutions.
@mehrosenasir99742 жыл бұрын
Thanks bro for your work. I have a html table in my email, how can I extract that into the google sheet?
@CodeWondo2 жыл бұрын
Hi Mehrose, Yes, 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 To get the HTML code from Gmail, you can actually use message.getBody() instead of message.getPlainBody()
@mehrosenasir99742 жыл бұрын
@@CodeWondo I have sent an email to you, if you have time please check.Many thanks!
@CodeWondo2 жыл бұрын
@@mehrosenasir9974 Hi, I will check it out for you
@mehrosenasir99742 жыл бұрын
@@CodeWondo Thank you so much bro
@johnatbnl8622 жыл бұрын
I was able to use App Script under Extensions then deploy the script to get the menu. I successfully exported a couple emails to Google Sheets, but formatting is included in the Body. How do I see only the text, not the formatting too? This request was sent by email. Not solution received.
@CodeWondo2 жыл бұрын
Hi John, I am not sure what formatting you exactly see in the email. Could you please send me a sample email and sample text over my email. My email is moa29000@gmail.com. It is better that you send me sample emails by downloading and attaching them as I demonstrate in the following screen recording: i.imgur.com/NfwPmi3.gif If there is any sensitive information in the email, then you can actually open the downloaded email using the text editor and then replacing the sensitive infromation with dummy texts. Save the file and attach it to me.
@JohnNaida2 жыл бұрын
@@CodeWondo Please see my email dated December 1. It has the attachment showing the formatting issue. Thank you.