I have coded logic where in I am importing data from CSV to Google Spreadsheet. As a next step I am trying to push the copied data to Cloud SQL instance using JDBC service. I have one column which is of type DateTime
(in backend). in logic which will push data from spreadhseet to Cloud SQL I am using Jdbc.parseDate()
method to convert the value in spreadsheet to Mysql /Cloud SQL.
ex: stmt.setDate(counter, Jdbc.parseDate(colValue));
Where:
In am attempt to do so, i get error:
We're sorry, a server error occurred. Please wait a bit and try again.
I did not get any error otherwise, not even when i use
stmt.setDate(counter, Jdbc.newDate(colValue));
Please advise how this can be resolved.
Finally the code that worked for me is:
// Iterate through the spreadsheet records,
var tempDate = Utilities.formatDate(colValue, "IST", "yyyy-MM-dd HH:mm:ss");
stmt.setObject(counter, tempDate);
Where:
colValue: is the value of the column reading from spreadsheet
counter: is the index, where I have to insert value
Using above code I was able to read the date from spreadsheet and insert it in column(of DateTime type) of table in cloud SQL database.