Question: I have:

```
points <- read_xlsx ("Data / PC-2021050200.xlsx", sheet = "coordinate")

```

Earlier in the code, I put the date "2021-05-02" which is a variable.
How to enter date as a variable in the file path?

Answer: 
With regard to your recent replies, might I suggest you not worry too much about the collisions and take an approach such as this:

```
import random
import string
string_set = set()
# Just digits at chars is 36 possibilities
chars = string.digits + string.ascii_uppercase

# For an 8 character string note that there are 36^8 possibilities
N = 8
gen_str = lambda: ''.join(random.choices(chars, k=N))
# This is about 3000,000,000,000 possibilities

# Let's create some strings
for i in range(10000000):
    chars = gen_str()
    # Python set implemented as hash table so this is O(1). (It doesn't slow down as set grows)
    while chars in string_set:
        #Regenerate random number if collision
        #(This is has a n / (36^6) likelihood of happening where "n" is the number of elements in the set so far). Until you exceed 1 billion elements this is a non-issue
        chars = gen_str()
    print("adding to set: ", chars)
    string_set.add(chars)

```

The primary downside of this approach is you'll need to store your set somewhere (pickle and unpickle it) and this will presumably double your memory usage for each 8-char stored in the database. This will also become impossible if your set is too large for your system memory in which case your could look into the "shelve" module which provides a dict-like database object which you can use in basically the same way as a set by ignoring the values stored to each key.
I like to use random generators directly. While python's random module is decent, with other languages I had some problems, e.g. when generating points in multidimensional space, some patterns were occurring.

Python support conversion to decimal integer from a base 36 numeral. So, to constraint the min value, convert string to integer and user *randint*, which readily supports intervals.

Conversion of regular base 10 integer into base 36 is more tricky, luckily you can use an additional library such or numpy or active state snipped from <https://code.activestate.com/recipes/65212/>. I just copied a sniped from an older stackoverflow answer, it was discussed many times, and more compact than activestates'.

```
import string
import random

alphabet = string.digits + string.ascii_uppercase
N = len(alphabet) # 36
MAX1 = int('0000WXYZ', N) + 1
MAX2 = int('ZZZZZZZZ', N)

digs = alphabet

def int2base(x, base):
    digits = []
    while x:
        digits.append(digs[int(x % base)])
        x = int(x / base)
    digits.reverse()
    return ''.join(digits)

r = int2base(random.randint(MAX1, MAX2), N)
if len(r) < 8:  # pad with 0 if needed
    r = rjust(r, '0')

```

Disclaimer. The python random number generator is quite good, yet, it is possible, since there is only so many unique string of the length 8. I run a few tests and usually it takes anywhere from a hundred thousand to a few millions. Even with a truly random numbers, you can get just anything, even duplicate, just try to toss a coin or roll a dice several times in row. Note, it is not great idea to update your the MAX each time as you will exhaust the list and reach the ZZZZZZZZ very soon (probably less than 30). If you feel strongly compelled 100% prevent duplicates, just build a list/set of already used strings, yet it is highly unlikely, unless MAX is close to ZZZZZZZZ.