I am creating a spreadsheet in google sheets that will be used to track the inventory of a property room. I am using QR codes as labels that will be placed on the property and will correlate to the pertinent information on that particular piece of property. I am using the following code...
=image("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=" & "Category"&A3 &
"Incident"&B3 & "Officer"&C3 & "Location"&D3 & "Owner"&E3 & "Description/Condition"&
F3 & "Date/TimeCollected"&G3 & "From/To(Date/Time)"&H3 & "From/To(Date/Time)"&
I3 & "From/To(Date/Time)"&J3 & "PropertyRoomLocation(Date/Time/Who)"&K3 & "KeepUntil"&L3)
Each row will correlate to one piece of property, and there will be several columns for different pieces of information on each piece of property.
So far, everything works just fine, however there is a formatting issues I run into when the data is displayed after scanning the QR code. When I scan the QR code, the information is displayed side by side as so..
Information1Information2Information3Information4
This is problematic as there are no spaces, and I understand that for whatever reason, spaces break up the code and prevent the QR code working. I am looking to have the information displayed with each new piece of information on a separate line as so...
Information1
Information2
Information3
Information4
It appears that I need to figure out how to add a line break somewhere between the &'s, and I cannot seem to get it to work.
To encode line breaks, you need to use percent encoding. The line break character is
%0A
.Hence your URL would need to be:
Note that manual percent encoding of URL isn't a good idea: if you have any illegal URL character in your data cells, this will break your QR code. The best would be to create a
URL encode
custom function to process your data cells.Here's such a custom function (use Tools→Script editor… to enter this in your sheet):
Now, if you have the following data:
And if you enter the formula:
into a cell of your spreadsheet, you'll get the following QR code:
(Note that $1:$1 refers to the entire first row in absolute reference, and 3:3 refers to row 3 in relative reference). Reading the QR code should yield:
Let us know if this solves your issue.