I have hundreds of spreadsheets in Google Drive and I am trying to find a value in one of the files.
For example, I need to find all sheets that have a $1000 value, but I don't want to open each one of my spreadsheets.
How can I search for a value in all of my Google Sheets?
Best Answer
Here is an Apps Script that searches all of current user's spreadsheets. If you have a lot of spreadsheets, it might time out of hit some execution quota, in which case it may be better to restrict it to a folder: replace
DriveApp.getFilesByType
withThe value to search is entered on
var value =
line. Keep in mind that dollar sign in $1000 is just an element of formatting; the value is 1000.The search results (Spreadsheet name and sheet name) are logged: press Ctrl-Enter to view the log after the script is finished.
Technical detail: the try-catch block is there because the sheets without data (chart only sheets) throw an error when one tries to access their DataRange.