0

I currently have pre-filled links to a Google form, that are converted into QR codes with that formula in a Google spreadsheet:

=image("https://image-charts.com/chart?chs=150x150&cht=qr&choe=UTF-8&chl="&ENCODEURL(F48))

The problem is that the pre-filled links contain a reference to a cell with the current date and time (=NOW() formula). It means the we would theoretically need to print the new QR codes every second, which is obviously not possible.

Is there a way to make dynamic QR codes based on links which are provided by a spreadsheet?

In other words, the link in the dynamic QR code should not be a link that I would have to change manually, but instead it would pick it up automatically from a Google Sheets.

Is that possible?

Thank you in advance!

JvdV
  • 70,606
  • 8
  • 39
  • 70
  • Well, you could write a script for it; however, not sure about something, if you don't want to change the link manually, then the only thing that needs to be changed is the `NOW` formula and simply use a date/time value for it, no? If that is the case, why not simply reference a cell with this date and time (instead of `F48`)? If, however this is not what you want, can you share perhaps an explanation of what you want to achieve? – ale13 Mar 24 '22 at 10:55
  • I actually want to include the current time and date in the link, it looks like this as I write this comment: `https://docs.google.com/forms/XXX&entry.58566=Test+date&entry.98638=2022-03-24+13:41` – user10879705 Mar 24 '22 at 12:41
  • As per [this discussion](https://stackoverflow.com/questions/23177356/how-to-force-new-google-spreadsheets-to-refresh-and-recalculate#29448960) you can force a refresh of the google sheet (and thereby also your code) by simply pressing DEL on an empty cell. This can be automated in different ways. – MyICQ Mar 24 '22 at 13:39

1 Answers1

0

There is no way to modify the contents of a QRcode after it has been printed or produced; it will always be the same thing.

However, you can make it "dynamic" by storing a distinct URL* in your QRcode, and on the server side indicated by the URL, you can dynamically change the content associated with this unique URL to anything you want (via URL rewrite or database query), using the same QRcode.

That way, doing what you want, I think it would be necessary to follow a few steps:

  1. Make a script to get the data from your spreadsheet, you said you would need to change every second, so this data collection could not be manual.

For this I recall the official api of google spreadsheets, which if I'm not mistaken can be used for free, I'll leave the link here for you to take a look:

https://developers.google.com/sheets/api

  1. Integrated into this script, you would need a way to create and update the dynamic qr code.

As explained in advance, you can create them by creating one served to basically store information from a reference link and the final link.

But if you want to cut path, I know an api that already does this whole process for you, you would just have to consume it, and all the work to create and upgrade would already be being done.

I'll leave the link here, have a free plan, which you can test to see if it makes sense to you.

https://rapidapi.com/updeploy-tools/api/qr-code-dynamic-and-static1