Here is the scenario. You have a small business and you want to store your customers, products and sales information on separate Google sheets.
You’re probably going to have someone from your staff enter new customers, products are sales transactions.
We know if we get them to enter unique ID’s in manually that mistakes are going to get made. So how about we automate this process with unique ID’s based on date-timestamps.
Why use a date-timestamp to create a unique ID?
Every year is unique. Every day, hour, minute, second and millisecond of that year creates a unique number. This mean that a new unique id will be create every millisecond for us.
Wow! Wow! Wow! Yagi! Just hold it one damn minute! You could have multiple results each millisecond that would each be the same number!
Well, true if we were running a loop generating and publishnig our date-timestamp, we could have multiple numbers. However, we are generating this unique ID as an onEdit function when the user adds some information in Google Sheets to a cell and an adjacent cell returns our unique number.
The user’s input and then the calls to and from the server to the Google Sheet will be sufficiently slow enough not to have a number generated multiple times a millisecond, so we are safe there.
We have the main idea of what we are planning, let’s move onto the example.
When I created Yagisanatode.com my goal was to provide a resource for myself and others to reference on all the coding projects I work on. Since it’s beginnings in October 2017 I have seen a huge rise in my readership and am so pleased to see a growing community in my comments sections.
Your support has really helped me to produce more and, I hope, produce better content. Thanks.