Answers for "google apps script create csv from sheet and save in drive"

0

google sheets script sample export csv file in C drive

function convertRangeToCsvFile_(csvFileName, sheet) {
  try {
    var data = sheet.getDataRange().getDisplayValues();
    if (data.length > 1) {
      var rows = [];
      data.forEach(row => {
        var cols = [];
        row.forEach(col => {
          cols.push(`"${col.replace(/"/g, '""')}"`);
        });

        rows.push(cols.join(','));
      });
      
      return rows.join('\n');
    }
  } catch(err) {
    Logger.log(err);
    Browser.msgBox(err);
  }
}
Posted by: Guest on April-12-2021

Code answers related to "google apps script create csv from sheet and save in drive"

Code answers related to "Objective-C"

Browse Popular Code Answers by Language