Google表格Utilities.parseCsv函数仅返回字符串值

时间:2018-10-09 23:07:05

标签: csv google-apps-script google-sheets type-conversion custom-function

我在Google表格中有一个自定义函数,该函数通常运行良好,并在调用时返回一个csv。但是,所有值都将以文本形式返回,而不是以其常规数据类型返回,即数字不是数字。例如,如果我尝试检查3 =单元格D5,则该值为false。

我可以添加一些脚本来将特定的列转换为值吗?

下面是代码片段:

if (resultPath) {
   var csvPath = 'https://modeanalytics.com' + resultPath + '/content.csv'
   var csvResponse = UrlFetchApp.fetch(csvPath, options);
   var csvTextRaw = csvResponse.getContentText();
   var csvText = csvTextRaw.replace(/([“'])(?:(?=(\\?))\2[\s\S])*?\1/g, function(e){return e.replace(/\r?|\r/g, ' ') });

   return Utilities.parseCsv(csvText)

 } else {
   return 'Invalid URL!'
 }

enter image description here

0 个答案:

没有答案