Exact same issue attempting the same thing
three blocks
data query
Papa.unparse
smtp block = [{data: {{btoa(code.data)}}, name: "attachment.csv", fileType: "csv" }]
Tried the suggestion, still the same error "Use File Input component to upload a file and ensure file is uploaded before query is fired."