Excel file creation

Hi all,

i am currently facing an issue with a topic, the creation of an excel file or csv file. I am generating a list of data and i would like to download this data in form of a xls or csv file and tried different possible solutions.

1: checked if it is possible via a existing function to create a file and download it. with this it should work also offline.
2: tried it with custom code. this should also work offline.
3: builded an aws lambda function which should create and download the file. works only online.

Regarding the first option i was not able to find a function which is able to archive this goal.
The second option throw an error as document was set unknown
The third had the same problem as the second. Recieved a response but the download was not triggered. had to trigger it manually and the recieved the same issue.

Here the code for option 2:

const data = inputs.data;
const customer = "test Appgyver";

var csvContent = "data:text/csv;charset=utf-8,";

for (var category of data) {
  csvContent += 'Product Type ' + category.Name + ' \r\n';
  // Loop over selctedOptions
  csvContent += 'Selected Options \r\n';
  for (const selOptions of category.SelectedFields) {
    if (selOptions.Points > 0){
      csvContent += selOptions.Name  + ' \r\n';
    }
  }
  csvContent += 'Price Range ' + category.PriceRange + ' \r\n';
}
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "customers.csv");
document.body.appendChild(link); // Required for FF
link.click();
document.body.removeChild(link); 

Here the code for option 3:

const url = inputs.url;
const data = inputs.data;
const customer = "test Appgyver";
const body = {
  'customer': customer,
  'data': data
};
try {
  const res = await fetch(url, {
    method: 'GET',
    mode: 'no-cors',
    headers: {
      'Content-Type': 'application/json'
    }
  }).then( res => res.blob() )
    .then( blob => {
      var file = window.URL.createObjectURL(blob);
      window.location.assign(file);
});

} catch (err) {
  const error = {
    code: 'unknownError',
    message: 'Something went wrong.',
    rawError: err,
  }
  console.log(error);
  return { error }
}

I hope you can help me here. Thanks a lot.