In your Google Sheet, Click “Tools” and then choose “Script Editor“. Put the code given below. Don’t forget to use function in your result column as “=dodiff(cell1,cell2)“
function dodiff(a, b) {
if (a)
a = fix(a);
if (b)
b = fix(b);
if (Array.isArray(a) && Array.isArray(b)) {
if (b[1] > a[1]) m = b[1] - a[1];
else {
m = b[1] - a[1] + 60;
b[0]--;
}
if (b[0] >= a[0]) h = b[0] - a[0];
else {
h = b[0] - a[0] + 12;
}
m = m / 60;
return (h + m).toPrecision(4);
}
}
function fix(a) {
if (a)
x = a.toString().replace(" ", '').replace("am", "").replace("pm", "").replace("PM", "").replace("AM", "");
x = x.split(":");
x[0] = parseInt(x[0]);
x[1] = parseInt(x[1]);
return x;
}
There are 2 ways to do this, A and B both mentioned below
A) For Page Admins, the Messenger Platform also provides an easy setup tool for customizing your customer chat plugin. To use the setup tool, do the following:
Go to Page Settings > Messenger Platform
In the ‘Customer Chat Plugin’ section, click the ‘Set Up’ Button.
The url will look like https://www.facebook.com/YOURPAGEUSERNAME/settings/?tab=messenger_platform
OR
B) Go to Page Settings > Messenger Platform and Jump to Whitelisted Domains section
3 – Add Code in your website
Replace PAGEID with your page id obtained in step 1
HTML CODE (includes js code also)
<div id="fb-root"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="PAGEID" logged_in_greeting="Hi! How can I help you?" greeting_dialog_display="hide" logged_out_greeting="Hi! How can I help you?" theme_color="#0084ff">
</div>
<script>
window.fbAsyncInit = function() {FB.init({xfbml: true,
version: 'v4.0'});};
(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>