Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88087

Converting Google sheets to Excel 2003 (.xls) using Apps Script

$
0
0

Currently, it seems Google has no way of converting Sheets to .xls format. So, I'm trying to use App Script to parse values from Sheet into a .XLS format. Here's the sample code below.

var sheet = SpreadsheetApp.openById('1...3f');
var sourceFolder = DriveApp.getFolderById('17..f');
sourceFolder.createFile("Test File",sheet.getSheets()[0].getDataRange().getDisplayValues(), MimeType.MICROSOFT_EXCEL_LEGACY);

Data in Sheets has headers looks like this: sample data

However after converted to .xls, it looks like this all in cell A1: Name,Age,Fred,30,Jane,25

I've tried using:

Drive.Files.get(fileId).exportLinks[MimeType.MICROSOFT_EXCEL_LEGACY]

But Google doesn't support it. Has to be MimeType.MICROSOFT_EXCEL. Any help will be appreciated.


Viewing all articles
Browse latest Browse all 88087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>