Google Apps脚本中字符串的最大大小是多少?
问题描述:
我正在将Gmail附件中的csv文件导入到现有的Google电子表格中.
I'm importing csv files from Gmail attachments into an existing Google Spreadsheet.
我使用getDataAsString()来保存整个csv内容.我已经尝试过将其大小更改为大约6000个字符.此字符串最多可以容纳多少个字符?
I use the getDataAsString() to hold the entire csv contents. I've tried it varying sizes up to ~6000 characters. Is there a maximum number of characters this string can take?
答
Google Apps脚本中的字符串限制为 67,108,864(6700万)个字符.您可以使用以下功能自己尝试:
The limit for strings in Google Apps Script is 67,108,864 (67 million) characters. You can try it yourself with this function:
function strtest() {
var str = "a";
while (1) {
str = str + str;
}
}
输出:
I am not sure if there is a way to increase this through other means (for example, there is a fix for this in Wordpress).