LoginSignup
0
1

More than 3 years have passed since last update.

Google Apps Script 現在の日付を取得(スプレッドシート)

Posted at

はじめに

Google Apps Script 見積書からデータを転記し、請求書を作成(スプレッドシート)

上記の記事に追加情報という感じですが、請求書を作成した日の日付を記載したいとしましょう。

今日の日付を取得

//今日の日付
  var today = new Date();
//表示フォーマットを設定
  var todayData = Utilities.formatDate(today, 'Asia/Tokyo', 'yyyy年 MM月 dd日');

フォーマットは'yyyy/mm/dd'にすることもできます。

あとはtodayData

var sheet = SpreadsheetApp.getActiveSheet(); 
sheet.getRange('H2').setValue(todayData); //日付

みたいな感じにしてやればOK。

最後に

Google Apps Script 見積書からデータを転記し、請求書を作成(スプレッドシート)
の場合だと、

invoice.getRange('H2').setValue(todayData); //日付

となります。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1