我想隐藏google驱动器电子表格中列A中单元格中没有任何值的所有行。然后可以在需要时再次查看它们。这个函数的脚本/公式是什么?感谢
答案 0 :(得分:2)
更新以包含显示所有行的菜单:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var range = sheet.getRange(1, 1, sheet.getLastRow());
function onOpen() {
//add menu called Visibility onOpen
ss.addMenu("Visibility", [{
name: "Show All Rows", functionName: "showAllRows"
}]);
//get the values to those rows
var values = range.getValues();
//go through every row
for (var i=0; i<values.length; i++){
//if row value is equal to empty
if(values[i][0] === ""){
//hide that row
sheet.hideRows(i+1);
}
}
}
function showAllRows(){
sheet.showRows(1,sheet.getLastRow());
}
答案 1 :(得分:0)
我修改了Blexy的菜单,允许将空行隐藏为菜单项,而不是在onOpen中隐藏。
function getRecords(){
uNumber = $("#userNumber").val();
$.ajax({
crossDomain: true,
method: 'POST',
url: 'http://url/userReports',
data: {"Number": uNumber},
success: function(data){ //It was here I wasn't thinking about correctly
console.log(data);
$.each(data, function(key, value){
console.log(value.area);
area = value.area;
})
//I then displayed the returned data
document.getElementById("Table").innerHTML = area;
},
error: function(){
alert('error');
}
});
};