Answer the question
In order to leave comments, you need to log in
How do I import data from a text file that is saved daily to Google Drive?
Good afternoon. Help with script. Every day, a TXT file YYYY-MM-DDn.TXT is stored in Google Drive. How can I use a script to find this file and import data from it into an existing table with an existing sheet called dd.mm.yyyy? The date in the file name and the sheet name are the same, but are written in different formats. You need to import daily in automatic mode. Thanks in advance for your reply
Answer the question
In order to leave comments, you need to log in
Make a function, hang it on a time trigger (daily). In the function:
1) Open a file iterator with a specific name
var fileIterator = DriveApp.getFilesByName(fileName);
while(fileIterator.hasNext()){
var textFromFile = fileIterator.next().getAs(ContentService.MimeType.TEXT);
};
SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name).getRange(row, column).setValue(textFromFile );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question