How can I update a CSV file in netsuite ? I need t...
# suitescript
r
How can I update a CSV file in netsuite ? I need to add more columns and update the existing file.
d
CSV is basically a text. You can apply any string functions to it
r
Do you have the code for that? It's not happening
d
You first load a csv file from FileCabinet and you get it as text:
Copy code
const fileString = file.load({
    id: 123456,
}).getContents();
Then you do with the string whatever you want, then you save it :
Copy code
const fileObj = file.create({
    name: `${fileName}.csv`,
    fileType: file.Type.PLAINTEXT,
    contents: someAnotherText,
});