# Converting SVG Format to PNG Format using Google Apps Script

Gists

This is a sample script for converting the SVG image data to PNG image data using Google Apps Script.

Unfortunately, in the current stage, there are no methods for directly converting the SVG to PNG in Google Drive service. But it can be achieved by Drive API. The sample script is as follows.

## Sample script

function myFunction() {
const svgFileId = "###"; // Please set the fileId of the SVG file.

"=s220",
"=s1000"
);
const blob = UrlFetchApp.fetch(url).getBlob(); // blob is the image blob of PNG format.

// In this sample, the retrieved image blob is put to Spreadsheet.

• About Drive.Files.get(svgFileId).thumbnailLink.replace("=s220", "=s1000"), you can see the detail information at this repository.