I need to loop through each populated cell in my Google Sheet and remove these characters: {stringValue=}
.
One of my columns looks like this:
COLUMN NAME: category {stringValue=Pump} {stringValue=Motor} {stringValue=Motor} {stringValue=Flow Meter} {stringValue=Flow Meter} {stringValue=Flow Meter} {stringValue=Motor} {stringValue=Flow Meter} {stringValue=Pump} {stringValue=Motor} {stringValue=Pump}
I need to keep text such as Motor or Pump.
This is how I populate the sheet:
function importData() { const firestore = getFirestore(); const allDocuments = firestore.getDocuments('Data').map(function(document) { return document.fields; }); const first = allDocuments[0]; const columns = Object.keys(first); const sheet = SpreadsheetApp.getActiveSpreadsheet(); const ss = sheet.getActiveSheet(); ss.clear(); sheet.appendRow(columns); allDocuments.forEach(function(document) { const row = columns.map(function(column) { return document[column]; }); sheet.appendRow(row); }); }
https://stackoverflow.com/questions/67005770/loop-through-cells-in-google-sheet-and-remove-a-substring-of-text April 08, 2021 at 10:09PM
没有评论:
发表评论