Is it possible to clear content on a csv file and write new content from a spreadsheet on the same csv file on Google Drive? I need to keep the csv with the same fileId, so create/delete another csv is not an option (for Tableau to pickup the same file everyday).
I am thinking to use getDataAsString()
and setContent()
for the write part. But I can't seem to figure out how to just clear content on the csv file without changing it's fileId.
Thanks.
From File.setContent()
documentation:
setContent(content)
Overwrites the content of the file with a given replacement.
In other words, you do not need to clear the file. Just call the setContent()
function with the new content you want to put in there.