반응형

전체 글 493

Form Recognizer로 Azure Blob Storage의 파일을 읽어 텍스트 추출해보기

from azure.core.credentials import AzureKeyCredential from azure.ai.formrecognizer import DocumentAnalysisClient from azure.storage.blob import ContainerClient endpoint = "FORM_RECOGNIZER_END_POINT" key = "FORM_RECOGNIZER_KEY" def get_blob_url(): STORAGE_CONSTR = "BLOB_STORAGE_CONNECTION_STRING" SOURCE_NAME = "BLOB_STORAGE_CONTAINER_NAME" FILE_NAME = "sample.pdf" container = ContainerClient.from..

Azure 2023.06.28

Azure Cognitive Service의 Form Recognizer 사용해 보기

Azure Cognitive Service인 Form Recognizer 사용해본다. 구버전 tool Form OCR Testing Tool fott.azurewebsites.net 신버전 tool Form Recognizer Studio - Microsoft Azure formrecognizer.appliedai.azure.com 여기서는 새로운 버전을 사용해본다. 이유는 제일 아래... 1. 프로젝트 생성 Form Recognizer Studio 아래쪽으로 이동하면 [Custmo models] - [Create new] 버튼으로 프로젝트 생성화면으로 이한다. [Create a project] 버튼으로 새로운 프로젝트를 생성한다. 프로젝트 정보들을 입력해준다. 리소스를 입력해준다. 한국리전에서 생성한 ..

Azure 2023.06.23

Apps Script로 Google Sheets의 a1notaion을 getRange에서 사용되는 row, column, numRows, numColumns 범위로 변경

Apps Script로 Google Sheets의 데이터들을 가져올 때 getRange()를 사용한다. a1Notation을 그냥 사용해도 되지만, a1Notation을 입력 받고, 이를 getRange(row, column, numRows, numColumns) 으로 변경해야 할 경우가 있을 수도 있기 때문에 변환하는기능을 구현해본다. function getSheetValues() { const sheet = SpreadsheetApp.getActive().getSheetByName("상품리스트_지사용"); const range = convertA1NotationToRange("A2:C4"); console.log('영역변환 "A2:C4'); console.log(range); console.log(`..

GCP/Apps Script 2023.06.22

Google Sites에서 Apps Script로 배포한 webapp 으로 파라미터 넘기기

여태까지 webapp 은 get방식으로 파라미터를 넘겨왔다. 하지만 Google Sites에 배포를 하게되면 get방식으로 파라미터를 넘길 수 없다. 아무리 실행해도 응답이 없다. 이런 경우에는, get방식으로 파라미터를 넘기는 것이 아니라 google.script.run 을 이용해 html에서 GAS의 function을 실행해야 한다. google.script.run 클래스 (클라이언트 측 API) | Apps Script | Google for Developers 이 페이지는 Cloud Translation API를 통해 번역되었습니다. Switch to English 의견 보내기 google.script.run 클래스 (클라이언트 측 API) 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를..

GCP/Apps Script 2023.06.15

Apps Script로 장 종료 후 특정 주식의 종가 정보 카카오톡으로 전송하기

장 종료 후, goodEvening() 이라는 함수를 트리거로 실행시킨다. function goodEvening() { // 종가 확인 const dayBoolean = getTodayDay(); if ( dayBoolean ) { sendStockClosingPrice(); sendKospiClosingPrice(); } } /** * 요일 가져오기. 주중/주말 구분 */ function getTodayDay() { const curr = new Date(); const utc = curr.getTime() + (curr.getTimezoneOffset() * 60 * 1000); const KR_TIME_DIFF = 9 * 60 * 60 * 1000; const today = new Date(utc ..

GCP/Apps Script 2023.06.12

Apps Script로 Google Forms의 Dropdown 항목을 Google Sheets에서 가져온 데이터로 생성하기

Google Forms의 dropdown 항목을 생성해보았다. Apps Script로 Google Forms 항목(item) 추가하기 Apps Script로 Google Sheets 를 위주로 글을 쓰다가, Google Forms에 대해서도 한번 써보려고한다. 제공되는 Form class docs를 기반으로 작성해본다. Class Form | Apps Script | Google for Developers 이 페이지는 Cloud Trans whiseung.tistory.com dropdown 항목들을 Google sheets에서 가져와 뿌려줄 수는 없을까? Google Sheets 에서 가져온 데이터로 Google Froms에서 dropdown 생성하기 const ITEM_TITLE = '가장 좋아하는 ..

GCP/Apps Script 2023.06.09

Apps Script로 Google Forms 항목(item) 삭제하기

Form 에 존재하는 모든 item 을 확인해본다. function getFormItems() { const form = FormApp.getActiveForm(); const items = form.getItems(); for ( i in items ) { console.log(`${items[i].getTitle()} - ${items[i].getType()}`); } } 모든 item 삭제 function deleteAllItems() { const form = FormApp.getActiveForm(); const items = form.getItems(); for ( i in items ) { form.deleteItem(items[i].getIndex()); } } 특정 item 삭제 func..

GCP/Apps Script 2023.06.08

Apps Script로 Google Forms와 Google Sheets 연동하기

Google Forms로 제출된 값들을 Google Sheets에서 확인할 수 있도록 연결해본다. 새로운 Google Sheets를 생성해 연결하는 방법과, 기존에 존재하는 Google Sheets와 연결하는 두가지 방식이 존재한다. 새로운 Google Sheets를 생성 해 연결하기 function setForm() { const SHEET_ID = "데이터가_존재하는_GOOGLE_SHEET_ID"; const SHEET_NAME = "데이터가_존재하는_GOOGLE_SHEET_NAME"; const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(SHEET_NAME); const values = sheet.getRange(`A1:A${sheet.ge..

GCP/Apps Script 2023.06.07
반응형