Can I use api calls on someone else's sheet? - google-sheets

I am writing some code to access someone Google Sheets and look for a keyword, if that keyword is present I want to grab another column. Is this possible? Or do I have to use my own Google Sheet?

You can only access spreadsheet owned by you or shared with you explicitly or indirectly (through a group, shared with anyone with the link, shared publicly)

Related

Is there a API call to replace a sheet?

I was wondering if there is a API call for Google Sheets where I can delete all cells in a given sheet and paste/replace with a new data. I have the new data in the form of its own sheet.
thanks!
Update cell values with Google Sheets API
Since you mentioned that you need an API call for this, I think your way to go is to use the batchUpdate method from the Google Sheets API as it is the closest thing to what you are looking for.
With the batchUpdate method you can send a UpdateCellsRequestin order to replace the information from the cells you are looking for. I will leave the official documentation below so that you can check what I just mentioned.
References:
Method: batchUpdate
Reading & Writing Cell Values
UpdateCellsRequest
For a large existing file, it seems most expedient to delete the file and create a new one with Apps Script.
For delete, you can use DriveApp. Look for methods such as .getFileById(). Or, if you prefer to programmatically search for a filename in a folder, look for .getFolderById() and .getFilesByName(). Once you get the file object, you can either use Drive API's .remove() as shown in this answer or use DriveApp's .File.setTrashed. But note the latter moves file to trash bin, not literally remove from drive.
For file creation, you can use Advanced Drive Service. see this answer for exact steps.
As for populating the new sheet, the OP implies that step is already understood. (No particular data format was provided.) So we are done!

Log in for Google sheets for every member

Is it possible that we can create a log in panel on google sheets which can be access by only shared person once they log in and after that they get the only tab which is shared with them instead of whole google spreadsheet
I heard it is possible but haven't seen somewhere ..!!!
You could create a log sheet "which can be access by only shared person once..." and could then share by user.
Still.
It would not really serve your purpose since anyone with editor privileges will always have access to the history of the whole sheet (where one can easily see who edited what and when).

I need to integrate Google cloud translation API to google sheets using macros

I Cant find any workable solution. Can anyone help? Need to make translate from 1st sheet in one doc to the second. About 60.000 changeable rows.
You can use the Google Translate function directly in your sheet
If you want more advanced/customized calls, I recently wrote an article where I use the current user credential and I call a Google Cloud API (not the translate, but the principle is the same)

Creating a link to download whole spreadsheet from Google Drive

I want to create download link for my spreadsheet on google drive and I read about something like that:
https://docs.google.com/spreadsheets/d/MY_SPREADSHEET/export?format=csv
But it only downloads first sheet. I've read about GID parameter, but I don't want to spend time developing something that will get all GID's from API, and then download every sheet. Is there any way to have one link that leads to download of whole spreadsheet?
You might want to try suggestion in Labnol's guide:
Open your Google Spreadsheet in the browser, make the sheet Public (or Anyone with a link) and make a note of the shared URL. It should be something like this:
https://docs.google.com/spreadsheets/d/FILE_ID/edit?usp=sharing
The direct download links use a similar format as Google Documents and will read like:
https://docs.google.com/spreadsheets/d/FILE_ID/export?format=xlsx
https://docs.google.com/spreadsheets/d/FILE_ID/export?format=pdf
In addition to that, you may want to also try using the suggested URL in this SO post and see if it will help.
https://docs.google.com/spreadsheets/u/1/d/${id}/export?format=csv&id=${id}&gid=${gid}

Authorize just one spreadsheet in the Google Spreadsheet API

I'm working on some .Net code to collect some data on a server and put it in a Google Spreadsheet. The job needs to run once a day, clear out the sheet and repopulate it. I have all that working, but I can't get the authorization right. I can do it with my personal Google credentials, and I can get it to work with OAUTH by allowing the app to manipulate all my spreadsheets using the https://spreadsheets.google.com/feeds scope. But, what I really want to do is allow my script to read and write just one sheet. Is that possible, and how would I do that?
You are using very old scopes. Look at the drive.file scope
https://developers.google.com/drive/web/scopes
Its not possible using the spreadsheets API. That api is very old and doesnt have a scope for indivdual files.
it might be possible by creating a spreadsheet using the drive API by uploading a CSV with conversion, but you will need permission to create new drive files and that also means permission to the entire drive.
Workaround: Create a new google account and share the spreadsheet with it. Do the OAuth using the new account.
#Zig Mandel is right - the API (Gdata style) wants access to all spreadsheets. But you can workaround the problem using a new account.

Resources