Forum Discussion

QuinnFrancis's avatar
QuinnFrancis
Qrew Member
6 years ago

Quick Base to Google Sheets: "Could not parse text." ERROR

I am very new to all scripting languages. I have been successful with the following code for some of the cleaner tables I have in Quick Base but cannot get this to run for tables that may have special characters. I am currently receiving ERROR "Could not parse text."

Lets say for now I have to have random characters (*,#,","...) is there a way to have google script ignore them or replace specific characters  in some way?

Again I am very new to scripting and unfortunately any help needs to be an altered version of the script I have below.

Thank you for any help!!


var usertoken = "b3nbb6_kh9p_c6frt2mbbxxxxxxxxxxxxxxx";
var dbidprimary = "bnkmxxxxxx";

function urlFetchfromQB() {
var url = "https://az.quickbase.com/db/"+dbidprimary+"?a=API_GenResultsTable&options=csv&usertoken="+usertoken;
var fetchedObj = UrlFetchApp.fetch(url);

console.log(fetchedObj);
var csvData = Utilities.parseCsv(fetchedObj);
var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
sheet.getRange(1,1, csvData.length, csvData[0].length).setValues(csvData);

}

------------------------------
Quinn Francis
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    So the line it is having the error on is the very first line with a special character in it? You have verified this? I say that because that error can happen for many different reasons. You might have an extra new line or something like that, same error would happen.

    You will very likely have more help on something like Stack Overflow, I saw a bunch of issues that related exactly to this. Not sure which solution would be best for you but there were several. "utilities.parsecsv() could not parse text"