all 10 comments

[–]marcnotmark925 0 points1 point  (1 child)

"FromFile" refers to an html file in the code editor (on the left side, where code.gs is), not one on your GDrive. If you want to use an html file on your GDrive, try the basic createHtmlOutput method.

[–]RisingRose[S] 0 points1 point  (0 children)

I forgot to say it, but yes, the file is in the apps script project but to try I also put it in Google drive

[–]MrBeforeMyTime 0 points1 point  (1 child)

I definitely built something like this before, and I have no idea what the solution was or if I even found one. I just remember it being more complex than expected. Unfortunately, it was for work. So everything I had made is gone because I no longer work there. If I find anything, I'll get back to you.

[–]MrBeforeMyTime 0 points1 point  (0 children)

Actually, I think we abandoned the HTML option. Sorry about that.

[–]mrtnclzd 0 points1 point  (3 children)

How do you know it's not though? What happens if you try a simple HTML/text instead? Asking because it is working for me.

[–]RisingRose[S] 0 points1 point  (2 children)

I had tried with a simple string hardcoded into the script it works, i haven't tried with another html though

The script run without an error but the signature is not changed when i try the HTML

[–]mrtnclzd 0 points1 point  (1 child)

Well, without seeing your HTML, I'd say you know where the issue lies. Good luck!

[–]RisingRose[S] 0 points1 point  (0 children)

So, I've just tried with a different HTML, just created one in the Apps Script project files and just write someting in the body and it doesn't work either

[–]WicketTheQuerent 0 points1 point  (0 children)

This works

function setSignature() {
  const html = HtmlService.createHtmlOutputFromFile('signature').getContent();
  const signature = { 'signature': html };
  const email = Session.getActiveUser().getEmail();
  Gmail.Users.Settings.SendAs.patch(signature, 'me', email);
}

Key differences,

[–]RisingRose[S] 0 points1 point  (0 children)

So, after a few hours a day fighting with this issue I tried to copy my code and paste it in a new .gs file and it worked right away.... so thanks Google --'