I made a script in PHP to fit into a template I made in google sheets. I made the output text for convenience:
header("content-type: text/plain");
I didn't need html when I'm going for the =IMAGE or whatever. Now, I'm trying to make it so I can brainlessly copy and paste the output from my browser to the google sheets. "\t" worked completely fine for newlines, but "\t" is having some issues where google sheets thinks every single space in the tab is an actual space, so it gives an #ERROR! when i try to do multiple tabs at once.
the error: https://puu.sh/IOp2B/34b7f5ce50.png
here's my code:
$tab = "\t";
echo '=IMAGE("https://www.smogon.com/forums//media/minisprites/' . strtolower($final) . '.png")' . htmlspecialchars($tab) . $key . htmlspecialchars($tab) . substr(strval(($value/count($allteams) * 100)), 0, 5) . '%' . $tab . $value . "\n";
I tried "\t" itself, no htmlspecialcharacters, but copying directly from the webpage is consistently making it multiple spaces instead of a tab. I also tried with different browsers.
Here are my questions:
I don't think is a browser thing, I tried like 3 different ones and the issue persists. Also, if I put the output into pastebin/text editor, it works well after, but I don't want the user to HAVE to do this.
I am going to look into importxml, but I have no info on it yet... just thought I'd ask
tldr my plaintext output html code has been great but its not separating columns well for my google sheet template.
Instead of using tab or \t, write your formula as follows
echo '={image("https://i.sstatic.net/5iCFq.png"),"other info","next info"}'
use ,
(or ;
according to your locale) to separate the different cells and curly brackets { }
include specific information as usual in php with .
and $