I want to convert the numbers in ColA to normal numbers, like the ones I have in ColB. The one in ColA currently are in this format: 00:56:00.000. I initially started out with a time length, that I then converted to seconds (what's currently in ColA). I need to convert them back into a single number to import into Data Studio so it can read it as time. If I try to change the formatting to a number it comes up as a decimal, how can I change the format to a number? Or can I do it in Data Studio?
https://docs.google.com/spreadsheets/d/1xaAfc6hcFJJ1JsPfrx9Ly3usfljuzELT80UsgSxcNM8/edit#gid=0
Try this on col B3
on Google Sheets while A3:A
is converted into number format (in decimals):
=Arrayformula((A3:A*3600)*24)
Output:
Explanation:
This is just an observation, but it seems that Google Data Studio strictly follows the formatting of the cell values. If you want to read the seconds as integers, a few arithmetic operations was performed to convert the number formatting of duration as such presented above.
Apps Script (use this if removing helper column B):
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var data = ss.getRange('A3:A').getValues();
Logger.log(data);
var second = 3600;
var hour = 24;
var output = data.map(x => [x[0] * second * hour]);
ss.getActiveSheet().getRange(3, 1, output.length, output[0].length).setValues(output);
}
Output: