Is it possible, when exporting a Google Spreadsheet into a CSV, to apply this operation only to filtered set of rows?
I need to get in CSV exactly the rows which are visible on the sheet after a filter is applied to it.
Apparently not. I've just wasted half an hour trying to figure out a way to save filtered data, to no avail. It always saves all rows, regardless of the filter selection.
Create a new sheet (Sheet2) within the spreadsheet.
Set the A1
cell to be =filter(Sheet1!A:X, Sheet1!A:A>1)
. (See docs on the filter
function.)
You should then be able to save or export Sheet2 as CSV with only the filtered values.
IMPORTRANGE
, connect the spreadsheet to Google Data Studio, etc.
Commented
Jan 20, 2020 at 22:43
(range:one>5)*(range:two<10)
and not range:one>5*range:two<10
.
Commented
Apr 14, 2020 at 19:42
*
) for AND and addition (+
) for OR in the filter conditions. Use arrays {colA,colC}
or FILTER(FILTER(range,condition_by_rows),condition_by_columns)
to filter both rows and columns
Commented
Apr 15, 2020 at 7:24
Old-school way:
The best way to do this is to just select the cells you want to save as CSV, paste it into notepad, then find/replace tab with a comma.
You can make a Pivot table for that, inserting the desired filter. Then just export it as CSV.
Open a Gdocs spreadsheet, look at the menu item: 'Tools::Script Gallery', do a search for csv, and you'll find a script that takes an arbitrary named range, converts it to to csv and emails the result to you. I can't vouch for the script at all, but it seems to work.
If you look at it in the Gdocs Script Editor, you can see that it builds a CSV by actually parsing the spreadsheet data rather than using an internal export function, so it may not work perfectly for all cases. If it doesn't do what you want out of the box, it looks like this would be pretty easy to modify. I haven't tried it on filtered data, but it gets its data from a call to 'SpreadsheetApp.getActiveSpreadsheet()' which has a '.getActiveSelection()' method, so you might be able to bypass the whole named range thing.
IMPORTRANGE
.