Effi Q
Effi Q

Reputation: 21

Inserting multiple CSVs from to one Google sheet

I have a recurring process where I have a zip file with 4 CSVs that I want to add to a google sheet (new or existing). Is there a way to automate this?

It's just a one time import, not live data.

Upvotes: 0

Views: 1062

Answers (2)

doubleunary
doubleunary

Reputation: 19238

To do this manually, use File > Import four times and choose the Append to current sheet option each time.

To automate this with a Google Sheet formula, the data must be in .csv files rather than a .zip file, and those files must be reachable through the web without authentication.

If you can automate the unzip process and place the files in the cloud someplace, say a Dropbox folder, so that the file URLs are always the same, you can use importdata() like this to concatenate the files:

={
  importdata("...url1.csv"); 
  importdata("...url2.csv"); 
  importdata("...url3.csv"); 
  importdata("...url3.csv") 
}

To automate this with Apps Script, use an installable trigger to run a function that uses UrlFetchApp, Utilities.gunzip and Utilities.parseCsv() to get the data, Array.concat() to merge the files, and Range.setValues() to write the results in the spreadsheet.

Upvotes: 2

h__g
h__g

Reputation: 82

To reference a cell or range of cells in another worksheet in the same workbook, put the worksheet name followed by an exclamation mark (!) before the cell address.

In other words, in an Excel reference to another worksheet, you use the following format:

Reference to an individual cell:

Sheet_name!Cell_address For example, to refer to cell A1 in Sheet2, you type Sheet2!A1.

Reference to a range of cells:

Sheet_name!First_cell:Last_cell For example, to refer to cells A1:A10 in Sheet2, you type Sheet2!A1:A10.

After this you will write formulas ıf you add new excel only you can add formula SheetXX!A1:A10.

Upvotes: -1

Related Questions