To handle this calculation, you can create a custom code step in your Pipedream workflow that processes the data from the Google Sheets trigger. Here’s an example component that calculates the price based on the selected values: export default defineComponent({ async run({ steps }) { const selectedValues = steps.trigger.event; // Replace this with the actual data from the Google Sheets trigger let price = 0; selectedValues.forEach((value) => { if (["H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"].includes(value)) { price += 25; } else if (["AA", "AB", "AF", "AG", "AH", "AI", "AJ", "BC", "BD"].includes(value)) { price += 36; } }); return { price }; }, }); This component calculates the price based on the selected values from the Google Sheets trigger. Make sure to replace steps.trigger.event with the actual data from the Google Sheets trigger in your workflow. The calculated price will be returned as a step export, which you can use in subsequent steps of your workflow.
I apologize for the confusion. It seems there might be an issue with the data format of selectedValues. To help you better, can you please provide more information about the structure of the data coming from the Google Sheets trigger? This will help me understand the issue and provide a more accurate solution.
I believe the values are stored as an array called steps.get_values_in_range.$return_value[0]
Now I want to sift thru those values and based on where they appear in the area price the accordingly. I also want to note that value in each column can be between 0 to 5.
So if H2 has a value of 5, it should be 5 x $25 = $125.
I understand that you want to calculate the price based on the values in the range A{{steps.trigger.event.rowNumber}}:BD{{steps.trigger.event.rowNumber}}. Here’s a custom code step that processes the data from the Google Sheets step and calculates the price accordingly: export default defineComponent({ async run({ steps }) { const selectedValues = steps.get_values_in_range.$return_value[0]; let price = 0; selectedValues.forEach((value, index) => { const column = String.fromCharCode(65 + index); // Convert index to column letter (A, B, C, ...) if (["H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"].includes(column)) { price += value ** 25; } else if (["AA", "AB", "AF", "AG", "AH", "AI", "AJ", "BC", "BD"].includes(column)) { price += value ** 36; } }); return { price }; }, }); This component calculates the price based on the selected values from the Google Sheets step. Make sure to replace steps.get_values_in_range.$return_value[0] with the actual data from the Google Sheets step in your workflow. The calculated price will be returned as a step export, which you can use in subsequent steps of your workflow.