Integration of Gmail with UiPath can be achieved through IMAP or SMTP protocols. But to retrieve email messages, you will have to use the Get IMAP Mail Messages activity of IMAP. Use the following values to configure its properties.
Using this activity, you will be able to retrieve the email messages in the Output > Messages property which can store a list of messages. Then use this output variable for further processing. In your case, you can use a For Each activity to store every individual message as required.