Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Create an email query with data from google sheet added through your appsmith cite

Issue

I want to incorporate data from multiple Google Sheets into emails on Appsmith. I added columns to the sheets and want to include the new information in the email. I need assistance on how to retrieve the specific information and display it clearly in the email. Additionally, I want to know how to access data with matching IDs in two different sheets and include that information in the email as well.

Resolution

To send emails with information from Google Sheets using Appsmith, you can create a workflow and use the Fetch Detail operation on the GSheets integration to retrieve data. The retrieved data can be bound to a Table widget on Appsmith, and you can access it via {{ TableName.data }} / {{ TableName.selectedRow }} properties. If you want to access the data from the last row, you can use the slice operation: {{Table1.tableData.slice(-1)}}.

If you want to access multiple rows at a time, you can enable multi-row selection on the Table widget and use the selected rows property. You can save the retrieved data in a local store using the storeValue function and access it in an email.

To combine data from two queries based on a particular ID, you can use two map functions and filter them out with the ID to combine them using JavaScript. If the columns are different, you’ll need to filter them individually and bring them to your email. An example of the binded function is:

function(){
let combindedData = genderQuery.data.map((item) => {
const user = nameEmailQuery.data.find((userItem) => item.id == userItem.id) || {};
return { ...item, ...user };
})
return combindedData;
}