RhinoTekMN
RhinoTekMN

Reputation: 39

Timezone auto adjust for Google sheets cell data

I am trying to create an availability spreadsheet for people on a group google sheet, but we are all in different time zones. In order to avoid conversion confusion, I want to create a sheet that will auto adjust the cell data i.e. Ryan (who lives in the eastern time zone) says he is available on Monday from 5 to 10 PM. If Steve (who lives in the central timezone) looks at the sheet it will show that Ryan is available from 4-9 PM

Upvotes: 0

Views: 934

Answers (1)

pgSystemTester
pgSystemTester

Reputation: 9932

I'm pretty sure that the answer to your question is that it's not possible without doing some cavalier sheet manipulation or linking spreadsheets. Basically with the exception of random numbers, cells have to calculate to the same result for all users. If both Steve and Ryan opened the sheet, the date/time displayed is the same for both viewers.

The time zone is set within the spreadsheet settings, which is actually a good thing (otherwise users would need to specify what timezone they were entering date values in by each cell).

Looking at your very brief use-case, I might consider making sheets by time zone and then create a button that views which user it is. Or possibly have a button that sets the sheets time zone based on user? There are lots of workarounds but not in the direct method you're asking for.

As I wrote this response, I got curious and made this google sheets concept that selects the time zone by user, if they are listed in Column J and their timezone in column K. It's not great as it requires a click, but if you make your own copy and maybe you can get some ideas.

Here's the code I used in the script editor:

/**
 * @OnlyCurrentDoc
 */
const nUserCell = 'userCell';
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

/**
 * Returns the difference in minutes from spreadsheet from UTC.
 *
 *
 * @return The Difference In Minutes
 * @customfunction
 */
function getSheetTimeZone(){
  var d = new Date();
  return d.getTimezoneOffset();
}

function setUser(){
  var theUser = Session.getActiveUser().getEmail();
  ss.getRange(nUserCell).setValue(theUser);
}

Upvotes: 0

Related Questions