0

我有一个以文本格式发送响应的 API,如下所示:

"521942","556463745.63","11/1/2016 12:00:00 AM","0","11/1/2016 12:00:00 AM" 
"521942","17848781.34","11/1/2016 12:00:00 AM","0","5/23/2016 12:00:00 AM" 
"521942","8038249.48","11/1/2016 12:00:00 AM","0","5/18/2015 12:00:00 AM"

我需要将此响应导出到 CSV 文件中,但我无法这样做。我尝试使用文件对象方法:

var filename = "abc"; 
var outFilePath = 'C:\\Users\\archit.goyal\\Downloads\\' + filename + '.csv'; 
var jsonObject = xml2Json(responseBody); 
var file = new File({writetofile: new File(outFilePath).write(ReportCSV)});

但是这种方法抛出错误:

评估测试脚本时出错:ReferenceError: File is not defined

请查看此问题并提出建议。

4

0 回答 0