Skip to main content

Skip the grunt work: Use AI to turn raw data into Slides (Part 1)


Scenario

You've got to create a presentation using data from multiple CSV files. Typically, this means merging files into a single spreadsheet, generating charts, and copying everything into your presentation—an absolute time sink! Let’s fix that.

Here’s a free, no-code approach using Google Workspace tools and a sprinkle of automation. This is Part 1 of a two-part series.

The Problem Simplified:

  • Multiple CSV files in a consistent format (I used stock data).
  • The goal: Combine into one Spreadsheet for easy analysis and charting.
  • How: Instead of manual copy-pasting, we’ll automate the process using Google Apps Script and Chat-GPT for code generation.

What You'll Need:


Step-by-Step Solution:

1. Collect your data

  • Upload the CSV files to Google Drive.
  • Copy the Drive folder ID. The folder ID is the part of the URL that comes after /folders/ (e.g., https://drive.google.com/drive/folders/your-folder-id).

2. Create your Spreadsheet
  • Open a new Google Spreadsheet.
  • Navigate to "Extensions" → "Apps Script" to open Google Apps Script editor.
  • Delete any code you see in the editor window. Keep the window open.
3. Generate code with Chat-GPT
  • Open Chat-GPT in another browser tab.
  • Ask: “Write an AppScript to merge CSV files from a specific Google Drive folder into one Google Sheet.”
  • Chat-GPT will generate the script for you. Copy this script and paste it into the Apps Script editor you opened earlier.

4. Edit the script

  • Replace 'YOUR_FOLDER_ID' with the Google drive folder ID.
  • Customize the name of your new spreadsheet by finding the line that says destinationSpreadsheet = SpreadsheetApp.create('prices'); and changing 'prices' to your preferred name.
  • Preserve the original CSV files by changing setTrashed(true) to setTrashed(false).


Modified script for reference

function mergeCSVFiles() {
  var folderId = 'YOUR_FOLDER_ID'; // Replace with your folder ID
  var destinationSpreadsheet = SpreadsheetApp.create('Combined_Data'); // Change the name if needed
  var folder = DriveApp.getFolderById(folderId);
  var files = folder.getFilesByType('application/vnd.google-apps.spreadsheet');
  
  while (files.hasNext()) {
    var file = files.next();
    var filename = file.getName();
    var fileId = file.getId();
    
    var tempSpreadsheet = SpreadsheetApp.openById(fileId);
    var tempSheets = tempSpreadsheet.getSheets();
    
    for (var i = 0; i < tempSheets.length; i++) {
      var tempSheet = tempSheets[i];
      var tempData = tempSheet.getDataRange().getValues();
      
      var newSheet = destinationSpreadsheet.insertSheet(filename.replace('.csv', ''));
      newSheet.getRange(1, 1, tempData.length, tempData[0].length).setValues(tempData);
    }
    
    DriveApp.getFileById(fileId).setTrashed(false); // Keep original files
  }
}

5. Save and run the script 

  • Click the play button (▶️) to execute the script
  • The first time you run the script, you’ll be asked to grant permissions to access Google Drive files. Review and approve the permissions.

Important Note:

To maintain data privacy, you can delete the script or spreadsheet after completing your task.


Conclusion:
You should have all the data neatly organized and ready for analysis. 
In the next post we will turn the spreadsheet into a presentation. 

Comments

Popular posts from this blog

Host a static website on Google Drive (in 5 easy steps)

You need to host a static website but don't have the time, money or resources to set up a web server.  Perhaps you're learning to code or just doing a demo. Here's a way to set up a web site at no cost, in just a few minutes. Step 1. Create a new folder in Google Drive. From Google Drive, Click 'Create', select 'Folder' and enter the folder name. (I chose 'hybrid' for this example, but you can choose anything you want). Step 2. Share the folder. First select the folder you created (displayed in the folder list), then click the sharing icon. In the Sharing Settings popup, go to the 'Who has access' section and click 'Change' The Visibility options pop up will appear. Change the Visibility option to 'Public on the web'.  Although set by default, make sure that 'Access' is set to 'Can view'. Click 'Save'. The folder is now shared. Click D

How to get the BBC iPlayer running when you live outside of the UK

(subtext: Get the World's most famous detective on your favourite browser) The new series of Sherlock has started on the BBC. If you live outside of the UK and you are too impatient to wait for your local TV content provider to host it for you - then fear not !! These simple instructions will get you up and running. In addition to the iPlayer you can access most of the other UK TV channels using the same method. Note: you can use the same method to access content in other countries - such as Hulu in the U.S. How it works:  In simple terms, the BBC iPlayer, like other players, perform a check to determine whether your internet access is originating from the UK.  So the trick is to ensure that your access to the BBC website will originate from the UK. First you are going to use a free piece of open source software that was designed to keep your internet access anonymous. You will add a setting that will ensure that the software makes use of servers in the UK whenever makin