Hyperlink for formatted cells#16
Conversation
|
@Shelvak The cell class was added spontaneously as a hack, so I feel adding a large number of properties is a bit iffy. However, when it comes to text styling, such as hyperlinks, bold, text color, and background color, a simple array alone feels insufficient. The 2D array is accessed like a string, but I feel like it should really be a cell object, but that would change things significantly, so it's difficult. # write
ws[1,1] = cell.new(text: "xxx", hyperlink:"yyy", background_color: "zzz")
# read
ws[1,1].text
ws[1,1].hyperlink
ws[1,1].background_colorAnyway, I made it so that it can be set like this. # write
worksheet.set_hyperlink_rich(1,1,1,1, "google", "https://www.google.com/")
worksheet[2,1].set_hyperlink_rich("gemini", "https://gemini.google.com/")
# read
# => "https://www.google.com/"
worksheet[1,1].hyperlink |
|
Great job @y-bonfire 🤝 |
|
I found the format supported by the Google API. There are a huge number of formatting options. Even if we could do this, there might be some discussion about whether we need charts or pivot tables. |
|
@y-bonfire yeah, I saw that and that's why I didn't implement the "assign" part, because there's no much need more than read it and assign I don't think we need more magic from a script/background tool. Let's keep it as you did 🤝 |
|
Indeed, this worked (although I felt it might not work because it's a formula).🤔 worksheet[1,1] = "=HYPERLINK(\"https://www.google.com/\", \"google\")" |
With this patch we can get the "real hyperlink" doing
rows[1,2].hyperlink. And let us add more cell properties in the future.Fix the original issue gimite#423.
Thanks @y-bonfire for reviving this project.