我有一个API,该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:未定义文件
请查看此问题并提出建议。