burnash / gspread

Google Sheets Python API
https://docs.gspread.org
MIT License
7.13k stars 949 forks source link

Unkown Function returning #NAME? #504

Open Rodrigoaz7 opened 6 years ago

Rodrigoaz7 commented 6 years ago

Hello,

I was just using some lines of code like this one: wks.update_acell('A1', formula), and had worked fine. but now I'm using a different formula =googlefinance("petr3"; "price"; DIATRABALHO(HOJE();-10);HOJE()). But the Sheet returnin the following error: "unkown function DIATRABALHO", but that function it's correct, even when I put the same formula directly into the sheet, it work fine.

What can I do this work just using update_acell ??

burnash commented 6 years ago

Looks like it's a function with the localised name since it's missing in Google spreadsheets function list https://support.google.com/docs/table/25273?hl=en but present if I enable Portuguese.

I've just released a new version of gspread (2.0.0) which uses a newer version of Sheets API — v4. Try to update and run your code to see if it solves the issue.

Rodrigoaz7 commented 6 years ago

i figure out the portuguese question, then I wrote all my functions in english and the data appears in my sheet, but when I do the request "worksheet.acell('A1').value" for example, it gives #NAME? and the others cells with data give a blank.

I already installed the version 2.0.0 of gspread but it gives the same problem. Can you help me on this?

Best regards,

burnash commented 6 years ago

Sure, can you provide a more detailed example (step by step) of what you do?

Rodrigoaz7 commented 6 years ago

First, I get the credentials by the json_keyfile_name:

scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name(BASE_DIR + 'path_of_json', scope)

Then I use the authorize: gc = gspread.authorize(credentials, client_class=Client)

After the authorization, I open my sheet: wks = gc.open("name_of_my_sheet").sheet1

Now comes the problem. First of all I update the cell 'A1" of my sheet with a function like this: wks.update_acell('A1','=googlefinance("petr3";"price";workday(today();-10);today())')

And it worked, because in my sheet, the table with the data appears, but when a I run a code to get those datas with wks.acell('A1').value, it's given to me #NAME?.

And when a run the code like that with another cell, like wks.acell('B2').value, for example, it gives blank (but there's data in my sheet).

Best regards,

lavigne958 commented 3 years ago

Hi @Rodrigoaz7, if you look at the following link, the error "#NAME" happens Chen your formula is not correct. See here error number 5 errors list

In your cas this is strange because you can see the values when opening your spreadsheet in a web browser.

Could provide some details, the exact formula you use? Are all functions in your formula accessible by gspread? Perhaps your formula access an other spreadsheets that gspread can't access?