I have a Google Sheet the contains three worksheets. The 2nd and 3rd worksheet is used to look up values for the first worksheet. How do I generate a PDF for JUST the first worksheet?
I have done the find a file Google Drive action but this provides a pdf of ALL THREE worksheet.
Hi
Good question.
Perhaps hide the 2 lookup worksheets.
Help topic:
Step 7 will return a GDrive File ID and the GDrive File Name for the GSheet.
You can use the GDrive File Name to search for the File in Step 13.
Otherwise, you can use the GDrive File ID as part of a dynamic direct link to get the CSV version of the GSheet.
Why not manually hide the 2 worksheet tabs on the GSheet template being copied?
Yes, should be doable via the GSheets API: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
Feedback from ChatGPT:
To hide a worksheet tab in Google Sheets using only HTTP REST requests without external libraries, you can use a tool like curl
. You'll need to interact with the Google Sheets API directly. Here's an example of how to do this:
-
Obtain your Google Sheets API credentials and API Key. You can follow Google's documentation to create a project in the Google Cloud Console and enable the Google Sheets API.
-
Set your API key and spreadsheet ID:
API_KEY="YOUR_API_KEY" SPREADSHEET_ID="YOUR_SPREADSHEET_ID" SHEET_NAME="Sheet1" # Change to the name of your sheet
- Use
curl
to make an HTTP POST request to hide the sheet:
curl -X POST \ "https://sheets.googleapis.com/v4/spreadsheets/$SPREADSHEET_ID:batchUpdate" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "requests": s { "updateSheetProperties": { "properties": { "title": "'"$SHEET_NAME"'" }, "fields": "hidden" } } ] }'
Replace "YOUR_API_KEY"
, "YOUR_SPREADSHEET_ID"
, and "Sheet1"
with your actual API key, spreadsheet ID, and sheet name.
This curl
command sends an HTTP POST request to the Google Sheets API, which will hide the specified sheet in your Google Sheets document.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.