forked from bm9520/VRC-Japan-Weather-Board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode
35 lines (25 loc) · 805 Bytes
/
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function myFunction() {
var testDate = new Date();
var secondDate = new Date();
secondDate.setHours(testDate.getHours()+6);
var date = Utilities.formatDate(secondDate, "GMT+9", "yyyyMMdd");
Logger.log(secondDate)
var updateFileId = "File_ID";
var imageURL = "https://smtgvs.weathernews.jp/s/forecast/img25/JAPAN."+date+".png";
//get image
var image=UrlFetchApp.fetch(imageURL).getBlob();
//update image
updateFileById(DriveApp.getFileById(updateFileId).getName(),updateFileId,image);
}
//Update Blob
function updateFileById(title,id,blob) {
var body = {
title: title ,
mimeType: 'video/mp4'
};
file = Drive.Files.update(body,id, blob);
}
var files = DriveApp.getFolderById("Drive_Folder_ID").getFiles();
while(files.hasNext()){
file = files.next();
}