Home > Software design >  Conversion of csv to google sheet splitting data in cells
Conversion of csv to google sheet splitting data in cells

Time:09-09

I have used the script which is available on here which helped with converting a csv file to sheets, enter image description here

function test() {
  try {
    let file = DriveApp.getFilesByName("Tests - Sheet1.csv").next();
    let blob = file.getBlob();
    let string = blob.getDataAsString();
    string = string.replace(/\n/g," ");
    console.log(string);
  }
  catch(err) {
    console.log(err);
  }
}

Execution log

9:02:44 AM  Info    before:
9:02:44 AM  Info    Id,Name,"Date
Hello",,TRUE,,,,,,
1,A,1/1/2020,,,,,,,,
2,B,2/2/2020,,,,,,,,
3,C,3/3/2021,,,,,,,,
4,D,4/4/2022,,,,,,,,
5,E,6/6/2022,,,,,,,,
9:02:44 AM  Info    after
9:02:44 AM  Info    Id,Name,"Date Hello",,TRUE,,,,,,
 1,A,1/1/2020,,,,,,,,
 2,B,2/2/2020,,,,,,,,
 3,C,3/3/2021,,,,,,,,
 4,D,4/4/2022,,,,,,,,
 5,E,6/6/2022,,,,,,,,
9:02:44 AM  Notice  Execution completed
  • Related