Answer the question
In order to leave comments, you need to log in
Where is the error in the Google Script code for export to txt?
Hello,
There is a table
Task: export through (starting from 1) a column (starting from line 3) to a txt file (take the name from the first line). For this I wrote a script
function export() {
var Folder = DriveApp.getFolderById("ID");
var SpreadSheets = SpreadsheetApp.openById('ID').getSheetByName('Минуса');
var values = SpreadSheets.getRange("A3:A").getValues();
var txtName = SpreadSheets.getRange("A1").getValues();
var text = values.map(function (a) {return a.join('\t');}).join('\r\n');
var Files = Folder.getFiles();
while(Files.hasNext()){
var File = Files.next();
if(File.getName() === txtName + ".txt"){
Folder.removeFile(File);
}
}
Folder.createFile(txtName + '.txt', text);
function export() {
var Folder = DriveApp.getFolderById("ID");
var Files = Folder.getFiles();
var SpreadSheets = SpreadsheetApp.openById('ID').getSheetByName('Минуса');
var lastRow = SpreadSheets.getLastRow();
var c =1;
for(var i = 3; i<=lastRow;i++){
for(;c<=15;c+2){
var values = SpreadSheets.getRange(i, c).getValue();
var text = values.map(function (a) {return a.join('\t');}).join('\r\n');}
for(;c>15;c+2){var txtName = SpreadSheets.getRange(1, c).getValues();}
while(Files.hasNext()){
var File = Files.next();
if(File.getName() === txtName + ".txt"){
Folder.removeFile(File);}
}
Folder.createFile(txtName + '.txt', text);
}
}
TypeError: Cannot find map function on avamys object
Answer the question
In order to leave comments, you need to log in
Replace
on the
But I wouldn't do that. The disk is a complex ecosystem of sensors and triggers. Perhaps you could dig a little deeper and understand the zen of the event model, maybe something will work more smoothly and smoothly, and really online.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question