Status Update
Comments
[Deleted User] <[Deleted User]> #2
* Calculates the sale price of a value at a given discount.
* The sale price is formatted as US dollars.
*
* @param {number} input The value to discount.
* @param {number} input The discount to apply, such as .5 or 50%.
* @return The sale price formatted as USD.
* @customfunction
*/
function salePrice(input, discount) {
let price = input - (input * discount);
let dollarUS = Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
});
return dollarUS.format(price);
}
mu...@google.com <mu...@google.com> #3
Hello there,
Thank you for bringing this to our attention. I was able to reproduce it and I forwarded it internally. Any updates regarding this shall be posted here.
Best regards
ol...@addonsforgapps.com <ol...@addonsforgapps.com> #4
ka...@gmail.com <ka...@gmail.com> #5
go...@jivrus.com <go...@jivrus.com> #6
ts...@gmail.com <ts...@gmail.com> #7
pr...@gmail.com <pr...@gmail.com> #8
ze...@gmail.com <ze...@gmail.com> #9
f....@outlook.com <f....@outlook.com> #10
yo...@gmail.com <yo...@gmail.com> #11
cl...@lelivrescolaire.fr <cl...@lelivrescolaire.fr> #12
mi...@gmail.com <mi...@gmail.com> #13
mi...@pwc.com <mi...@pwc.com> #14
ru...@gmail.com <ru...@gmail.com> #15
dh...@gmail.com <dh...@gmail.com> #16
dj...@gmail.com <dj...@gmail.com> #17
cc...@bettergov.org <cc...@bettergov.org> #18
23...@gmail.com <23...@gmail.com> #19
1. I tried saving the image's src (as string) into a cell instead of a cellImage, but it doesn't work because it exceeds the 50000 character limit. -> Solution: setting the cell image's AltTextDescription equals the src (funnily this doesn't have a limit).
2. When using the image, I create a new blob with its data set to the image's AltTextDescription with the type (i.e. "data:image/png;base64,") removed and decoded in base64.
Here is my code:
var myBlob = Utilities.newBlob(Utilities.base64Decode([sheet].getRange([range]).getValue().getAltTextDescription().replace("data:image/png;base64,","")), "image/png", [blob name]);
3. In my case, I used this blob to send the cellImage as an inLineImage with MailApp, but I assume this image blob can be used for other purposes as well until Google fixes the issue.
Hope this helps anybody ;)
cl...@lelivrescolaire.fr <cl...@lelivrescolaire.fr> #20
Thanks you for this workaround, would you please elaborate on how you retrieve the src as a string on step one ?
23...@eacstudents.com.br <23...@eacstudents.com.br> #21
23...@gmail.com <23...@gmail.com> #22
In step one I am referring to the original image which will be saved into a cell, so I already have access to the image and its src. For my application, I used an HTML canvas to generate an image, and then I converted it to a URL, which I passed on as the src. In any case, if you have an image in HTML/JS, I believe you should have access to its src using something like imageObject.src or toDataURL() (both return strings). I’m very new to AppScript, so I don’t know how other ways of getting images into sheets (without HTML) work; however, I assume that if you have the image (before you insert it into the cell), you should somehow be able to access the src. Anyways, here is my code:
HTML Script (JS):
google.script.run.insertCellImage(myCellRange, document.getElementById("canvas").toDataURL());
App Script Code:
function insertCellImage(range, url) {
MySheet.getRange(range).setValue(SpreadsheetApp.newCellImage().setSourceUrl(url).setAltTextDescription(url).build());
}
//To retrieve the image:
var myBlob = Utilities.newBlob(Utilities.base64Decode(mySheet.getRange(myRange).getValue().getAltTextDescription().replace("data:image/png;base64,","")), "image/png", "imageName.png");
I apologize if my answer doesn’t help much, but please feel free to ask any more questions.
Hope your program works!
cl...@lelivrescolaire.fr <cl...@lelivrescolaire.fr> #23
Unfortunately, the issue for me is to automatically retrieve images inserted in the cell by other people, so I don't have access to the source image.
However, it gives me food for thought for other issues, so thanks again.
jp...@google.com <jp...@google.com>
th...@gmail.com <th...@gmail.com> #24
The worst thing is that if you by accident copy a range that includes these images, you get an error 'Exception: Service error: Spreadsheets'. Good luck figuring that out if you previously didn't know that any CellImage object cannot be copied at the moment, and GAS editor doesn't give you any clues as to what is going on here.
Images are so crucial for any e-Commerce business and any business in general, that it is almost baffling that we are still having these bugs.
jo...@gmail.com <jo...@gmail.com> #25
jo...@nupelia.uem.br <jo...@nupelia.uem.br> #26
I test
ra...@gmail.com <ra...@gmail.com> #27
in...@gmail.com <in...@gmail.com> #28
sc...@gmail.com <sc...@gmail.com> #29
hh...@gmail.com <hh...@gmail.com> #30
na...@intrigueme.ca <na...@intrigueme.ca> #31
vi...@gmail.com <vi...@gmail.com> #32
ar...@decathlon.com <ar...@decathlon.com> #33
I will store image url in another cell as workaround but this is a bit stupid :(
jp...@google.com <jp...@google.com> #34
I am marking this issue as FIXED
as the internally reported issue has been marked as FIXED
. Please note that there may be a delay in rolling this out to production. Thank you for your patience and please comment here if the issue remains.
lu...@digital-democracy.org <lu...@digital-democracy.org> #35
ja...@zerolight.com <ja...@zerolight.com> #36
jp...@google.com <jp...@google.com> #37
Sorry, this was a documentation update and triggered a marking as FIXED
instead of intended behavior.
For most newly inserted images, the source url is unavailable.
be...@work.bri.co.id <be...@work.bri.co.id> #38
manually we can right-click on cell -> show edit history -> image,
we just need some formula like = IMAGEURL('A1')
or method getImageUrl()
so we can get some output string like
Description
On January 19, 2022, 2 Classes of
CellImageBuilder
andCellImage
have been added. When these classes are used, an image can be put into a cell. The sample script is as follows.This works fine.
When the cell inserted the image using the above script is retrieved by the following script,
the value of Ref
cellImage
is the object of Class CellImage. There are 5 methods in Class CellImage.In order to retrieve the URL of the image which was put into a cell using
setSourceUrl
with an URL, when the following script is used,no value is returned. The document of
getUrl()
saysGets the image's source URL; returns null if the URL is unavailable.
. But, even when the URL is a valid URL, no value is returned. And also, whencellImage.getContentUrl()
is used, the following error occurs.Unfortunately, the image inserted using the top of the script cannot be retrieved.
When the inserted image can be used, I think that it will be useful for a lot of users. I'm not sure whether this is the current specification and/or a bug. But I thought that this might be a bug from the document of
getUrl()
.References