Data Recovery

I have a probelm with an app syncing, thankfully only 22 records but all the same important ones. tried all the normal methods recvoery mode etc but still stuck. Got user to send recovery email data but now need to get that data into excel so that I can  import it into the main tables, any ideas?

Many thanks

Brad

update: solution found, I simply pasted the data into the link and it done all the work for me putting it into excel (pretty much) https://data.page/json/csv 

0 6 449
6 REPLIES 6

Aurelien
Google Developer Expert
Google Developer Expert

Hi @bradley_davis1 

 

Here is a good tip:

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/Best-Practice-for-Data-Recovery-from-quot-Recov...

 

I didn't retrieve the post explaining how to deal with it.

But basically, you may want to use the Chrome extension "AppSheet toolbox", in the menu here:

Aurelien_0-1646221131062.png

 

I did try this, there is another version you can use in edge https://www.qrewtech.com/recovery/ however even when i do this it coverts it into a csv but still not readable by excel or google sheets

Did you try open the csv with Excel ? You should have an option "convert data" or something like that.

Once it's done, you can copy-paste the data in the correct spreadsheet

So basically i got the email from the user with the data attached, i then placed that into a txt file. Then i used the appsheet recovery to convert it (https://www.qrewtech.com/recovery/) and it comes up with a csv file that is 0 bytes and of course nothing in it.

ok got an update just found a solution, I simply pasted the data into the link and it done all the work for me putting it into excel (pretty much) https://data.page/json/csv 

One of the ways I found works best for me is have them click on the 'View' data in the Appsheet app menu which will send you a recovery file. Then if you are sufficient working in Google Apps Script, I loop over the recovery files and add sheets in Google Sheets with the row headers and then the data. After that I can select each tab in the Sheets file and process it using the Appsheet API. I posted the code below:

function myFunction() {
  var files = DriveApp.getFolderById('YourFolderID').getFiles();

  while(files.hasNext()) {
    var file = files.next();
    var contents = file.getBlob().getDataAsString();
    var parsedcontents = Utilities.jsonParse(contents);
    var tablename = parsedcontents.tableName;
    var ssfile = SpreadsheetApp.getActive();
    var sheet = ssfile.getSheetByName(tablename);

    var rowkeys = Object.keys(parsedcontents.row);
    var header = [];
    var values = [];
    var ssobject = [];

    if(sheet === null) {
      var newsheettab = ssfile.insertSheet().setName(tablename);
      for (var i in rowkeys) {
        header.push(rowkeys[i]);
        values.push(parsedcontents.row[rowkeys[i]]);
      }

      ssobject.push(header);
      ssobject.push(values);

      newsheettab.getRange(1, 1, ssobject.length, header.length).setValues(ssobject);
    } else {
      var existingdata = sheet.getDataRange().getValues();
      var existheader = existingdata[0];

      for(var j in existheader) {
        values.push(parsedcontents.row[existheader[j]])
      }
      sheet.appendRow(values);
    }
  }
}

function appsheetconversion() {
  var appid = 'YourAppID';
  var accesskey = 'YourAppAccessKey';
  var activesheet = SpreadsheetApp.getActiveSheet();
  var values = activesheet.getDataRange().getValues();

  var sheetname = activesheet.getName();
  var url = 'https://api.appsheet.com/api/v2/apps/' + appid + '/tables/' + sheetname + '/Action?applicationAccessKey=' + accesskey;

  var rows = [];

  for (var i = 1; i < values.length; i++) {
    var obj = {};
    
    for (var j in values[i]) {
      obj[values[0][j]] = values[i][j];
    }
    rows.push(obj);
  }
  //console.log(rows);
  //console.log(sheetname);

  var payload = {
    "Action": "Add",
    "Properties": {
      "Locale": "en-US",
      "Location": "47.623098, -122.330184",
      "Timezone": "Pacific Standard Time"
    },
    "Rows": rows
  }

  //console.log(payload);

  var options = {
    'method': 'post',
    'contentType': 'application/json',
    'muteHttpExceptions': true,
    'payload': JSON.stringify(payload)
  }

  var request = UrlFetchApp.fetch(url, options);
  var response = request.getContentText();
  console.log(response);
}
Top Labels in this Space