kkotak
kkotak

Reputation: 353

Bulk convert csv files in Google drive to Google Sheets

I'm trying to select a few csv files that are in my Google drive and convert them to Google Sheets files. I know that I can do this one by one using the Open option, but since I have hundreds of files, I'm looking for a way to do this using multi-select and convert.

Upvotes: 8

Views: 8349

Answers (1)

user3717023
user3717023

Reputation:

I know two ways to convert multiple files, and "multi-select and convert" is not one of them.

Reupload

Download the files, then upload again, having first enabled "convert uploads" in Drive settings.

Script

Using an Apps Script, one can convert CSV files to Google Spreadsheet format automatically. First, move the files to be converted to a folder and take a note of its id (the part of the shareable link after ?id=). Use the folder id in the following script.

function convert() {
  var folder = DriveApp.getFolderById('folder id here');
  var files = folder.getFiles();
  while (files.hasNext()) {
    var file = files.next();
    Drive.Files.copy({}, file.getId(), {convert: true});
  }
} 

Follow the instructions to enable Advanced Drive Service, which is used by the script. Finally, run it. It will create converted copies of all files in the given folder.

Upvotes: 12

Related Questions