CSV Creator

Create a CSV format file

OUTPUT FILENAME

Set the output filename (excluding the file extension), and if the file already exists in the working directory, the existing rows will be loaded into the output array, allowing the script to continue adding new rows to the existing rows. The script can delete pre-loaded rows to create a new table.

Input Object

In the input object, each key represents the filename (excluding the extension) of a TXT file in the workspace, and each value represents the text content of that file.

// Read the values from row-name.txt and row-price.txt in the workspace
let name = input['row-name']
console.log('name:', name)

let price = input['row-price']
console.log('price:', price)

Output Array

Each object element added to the output array represents a row of data for the output table. The key in the object represents the header field, and the value represents the data for that field in the row.

// Add a new row with data from files in the workspace, refer to the example above for how to read data from files
output.push({
  name : name,
  price : price,
  tax: price * 0.05
})

// Specify the header fields, from left to right
output.header.push('name','price','tax')

--

We are dedicated to improving our content. Please let us know if you come across any errors, including spelling, grammar, or other mistakes, as your feedback is valuable to us! 🤖️⚡️

Last updated