r/GoogleAppsScript • u/IntrepidBlueberry_ • Sep 22 '22
Question Turn each rows from Google Sheets into a line of text in Google Docs and keep formatting?
Hi everyone.
I am trying to take a worksheet in Google Sheets that contains some formatted information and export the contents of each row (all of them) into a new Google Doc file as a line of text while keeping the formatting and adding some extra features (namely bolding the first column, adding a ":" and changing the link in the sheet to a shortened word that is hyperlinked).
Basicaly the goal is to take a worksheet like this:
| Book Title | Review | Link |
|---|---|---|
| Winnie the Pooh | This book is good. | www/amazon/com/1 |
| Little Red Riding Hood | This book is bad. | www/amazon/com/2 |
| Goldilocks | This book is just right. | www/amazon/com/3 |
And get each row entered as a line of text as such:
Winnie the Pooh: This book is good. (link)
Little Red Riding Hood: This book is bad. (link)
Goldilocks: This book is just right. (link)
I have managed to get one row to print to a new google doc, to get each row to print to its own separate doc (fun to delete 100 new files that suddenly appeared), and to reprint the table with the formatting.
However, I have not achieved my desired result.
Any advice? Pretty new to writing scripts, so I understand the logic of it all, but necessarily the best and most efficient way to write something like this.