lunes, 18 de noviembre de 2024

Google Sheets - script to list all formulas in selected range of current sheet

 function getFormulasFromSelectedRange() {

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getActiveRange(); // Gets the currently selected range
  var formulas = range.getFormulas(); // Retrieves the formulas in the selected range
  var output = [];
 
  for (var i = 0; i < formulas.length; i++) {
    for (var j = 0; j < formulas[i].length; j++) {
      if (formulas[i][j]) { // Only add if there's a formula
        output.push(
          "Cell " + range.getCell(i + 1, j + 1).getA1Notation() + ": " + formulas[i][j]
        );
      }
    }
  }
 
  Logger.log(output.join("\n")); // Logs all formulas and their locations
}

martes, 10 de septiembre de 2024

JSON into EXCEL

Explica com convertir un JSON en XLSX

https://youtu.be/T_Jp2X9owQk 

volem analitzar amb EXCEL els projectes del CDTI, accessibles des de l'enllaç:

https://www.cdti.es/datos-abiertos-creditos-subvenciones-y-lineas


Amb el Python

import pandas as pd
import json

# Path to your JSON file
json_file_path = r'C:\Users\1664\proyectos_CDTI\proyectos_CDTI.json'

# Path to save the CSV file
csv_file_path = r'
C:\Users\1664\proyectos_CDTI\proyectos_CDTI.csv'

# Load JSON data
with open(json_file_path, 'r', encoding='utf-8') as f:
    data = json.load(f)

# Convert JSON to DataFrame
df = pd.DataFrame(data)

# Save DataFrame to CSV
df.to_csv(csv_file_path, index=False, encoding='utf-8')

print(f"CSV file saved to {csv_file_path}")


lunes, 8 de julio de 2024

moodle - border line in a table

<table>
    <tbody>
        <tr>
            <td style="
                       border: 4px solid red; 
                       background-color: #92a8d1; 
                       padding: 10px; 
                       text-align: right;">sde</td>


            <td style="
                       border: 1px solid blue;
                       text-align: right;
                       text-decoration: line-through;">d</td>
            <td style="
                       border: 3px solid orange;
                       text-align: right;"><s>h</s></td>
        </tr>
    </tbody>
</table>

domingo, 23 de junio de 2024

avaluació - ponderar RA amb Latex

 QMP = \frac{19}{100} \text{Q}_{RA1} + \frac{15}{100} \text{Q}_{RA2} + \frac{15}{100} \text{Q}_{RA3} + \frac{12}{100} \text{Q}_{RA4} + \frac{19}{100} \text{Q}_{RA5} + \frac{12}{100} \text{Q}_{RA6} + \frac{8}{100} \text{Q}_{RA7}

Latex

From Latex

viernes, 5 de abril de 2024

APPEND all the txt content of several files *.log in unique fiel output.txt (run in cmd)

 type *.log > output.txt

QUERY amb regex al GoogleSheets

 


Boxplot from data

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Boxplot Example</title>
    <!-- Include Plotly.js -->
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
    <!-- Your HTML content here -->
    <div id="boxplot"></div>

    <script>
        // Data
        const data = [
            [1, 1, 2, 7, 7, 5, 10, 3, 6, 8, 3, 4, 1, 7, 7, 4, 1, 5, 8, 6, 1, 2, 8, 4, 4, 6, 8, 6],
            [2, 2, 3, 5, 3, 7, 2, 4, 6, 2, 2, 2, 2, 3, 4, 4, 1, 3, 5, 2, 3, 5, 3, 3, 8, 8, 3],
            [1, 3, 7, 10, 8, 10, 7, 7, 9, 5, 4, 2, 7, 7, 6, 1, 4, 8, 6, 1, 3, 10, 7, 3, 9, 8, 9],
            [1, 4, 7, 8, 8, 6, 9, 9, 2, 6, 7, 8, 1, 6, 6, 1, 6, 7, 1, 3, 7, 1, 8, 7, 6, 7],
            [2, 3, 6, 8, 6, 9, 6, 6, 8, 3, 4, 2, 5, 5, 6, 6, 0, 4, 8, 6, 2, 3, 8, 4, 6, 7, 7, 6],
            [2, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 5, 8, 7, 9, 2, 7, 6, 1, 3, 7, 4, 7, 10, 8, 7],
            [3, 4, 7, 6, 10, 5, 7, 8, 4, 5, 5, 7, 6, 6, 1, 5, 6, 2, 3, 8, 5, 5, 8, 6, 6],
            [3, 5, 7, 6, 9, 7, 7, 7, 5, 6, 4, 6, 5, 7, 1, 2, 7, 1, 4, 7, 4, 6, 8, 7, 6],
            [4, 4, 6, 6, 9, 6, 7, 7, 5, 6, 5, 5, 6, 6, 2, 8, 7, 3, 4, 7, 4, 6, 8, 8, 6],
            [5, 5, 8, 5, 9, 6, 9, 8, 4, 4, 4, 5, 6, 5, 7, 7, 4, 5, 9, 6, 6, 9, 7]
        ];

        // Function to draw boxplot
        function drawBoxPlot(data) {
            const boxplotData = data.map(column => {
                return {
                    y: column,
                    type: 'box',
                };
            });

            const layout = {
                title: 'Boxplot Diagram',
            };

            Plotly.newPlot('boxplot', boxplotData, layout);
        }

        // Call the function with data
        drawBoxPlot(data);

    </script>
</body>
</html>