Export in-cell square product-pictures using App Script automatically

42 views
Skip to first unread message

Yaron Koresh

unread,
Jun 26, 2024, 4:18:28 PM6/26/24
to Google Sheets Community
I need to create an App Script function, to export square pictures from our table automatically, as PNG.

When i use the export API, with the link:

"https://docs.google.com/spreadsheets/d/{spreadsheet_id}/export?&exportFormat=pdf&format=pdf&size=1x1&fzr=false&portrait=true&fitw=true&sheetnames=false&printtitle=false&pagenum=RIGHT&gridlines=false&attachment=false&horizontal_alignment=CENTER&vertical_alignment=MIDDLE&alt=media&top_margin=0&bottom_margin=0&left_margin=0&right_margin=0&gid={sheet_id}&c1=4&r1=3&c2=5&r2=4"

It's just not looks good.

The problem is an error (status 500, internal server error), when i change top_margin into any positive number to fix the picture.

Maybe it's a bug, but anyway, I need your help for an alternative way to go now.

Using top_margin="0" does not fits my needs, because it puts my photo too high, outside of the top-border.

Then i changed top_margin (just to test), but i keep getting that error.

Yaron Koresh

unread,
Jun 26, 2024, 4:29:40 PM6/26/24
to Google Sheets Community
Sorry, now i realized that it's happening just because the size is 1x1... now actually I changed the size to a higher number of inches and it's working.
Solved, cheers.

Alexander Ivanov

unread,
Jun 26, 2024, 11:14:45 PM6/26/24
to Google Sheets Community
It's good that everything worked out!

Cheers!

Reply all
Reply to author
Forward
0 new messages